In this Microsoft Power Automate tutorial, we will learn how to append multiple values to an array in Power Automate flow. In addition, we will also cover how to append an array to an array variable in Power Automate.
Append multiple values to an array in Power Automate
Let us see how to append multiple values in an array using Power Automate.
Here we will create an instant cloud flow using Power Automate, with the following inputs to get the Employee ID, Employee Name, Employee Designation, Employee Gender, and Employee Date Of Joining.
- Employee ID – Number data type
- Employee Name – Text data type
- Employee Designation – Text data type
- Employee Gender – Text Type
- Date of Joining – Date data type
Open Power Automate, create an instant cloud flow, and Expand Manually trigger a flow and select add an input for the above field details with the mentioned data types.
- Select an initialize variable action from action triggers to initialize the variable in an array format. Enter the Variable name and choose the Variable type as array.
- Pass the dynamic content values in an array format in the Value section.
- Now add an Append to array variable action.
- In the Name section, select the existing array variable that we initialized.
- Pass the multiple values from dynamic content to append the values with the existing array variable in the Value section.
To see the output, add a compose action and pass the initialized variable. Save the Power Automate flow.
Run the flow manually and pass the values and click on the Run flow option.
Once the flow ran successfully, we can see the mentioned multiple values have been appended with the initialized array and displayed in the Compose action Output section as highlighted below:
This is how to append multiple values in an array using the Power Automate flow.
Another Example on append multiple values to an array in Power Automate
Let us see another example to append multiple values dynamically using Power Automate.
In this example, we will use the below Customers SharePoint List consisting of the below-mentioned columns. Initially, We will create an array variable and then we will append the array with Multiple values from a list.
Later We will convert the array values to string values to update the SharePoint List Complete Address Column.
- Customer Name – Default title column
- Customer Email – Single-line text
- Contact Details – Number
- Address 1 – Multi-Line Text
- Address 2 – Multi-Line Text
- State – Choice
- Country – Choice
- Zip Code – Number
- Complete Address – Multi-Line Text
To achieve this, Follow the below steps:
- Open Power Automate, and create an Automated cloud flow with the trigger when an item is created or modified.
- Configure the SharePoint site address and the list name.
- select an initialize variable action from action triggers to initialize the variable in an array format. Enter the Variable name and choose the Variable type as array.
- Under the Expression tab pass the below code to create an array and pass the dynamic values of Customer Name, Customer Email, and Contact Details from a list. Click the ok or Update option.
createArray(triggerOutputs()?['body/Title'],triggerOutputs()?['body/CustomerEmail'],triggerOutputs()?['body/ContactDetails'])
Where,
- Create Array – Function name
- Title, CustomerEmail, ContactDetails – Dynamic Values.
- Now add an Append to array variable action. In the Name section, select the existing array variable that we initialized.
- Pass the multiple values from dynamic content from a list to append to the existing array variable in the Value section.
- Add a new step and Join Data Operation to convert the array values to the string value with the separator comma to update the SharePoint list complete address column with string type.
- In the From section, pass the Variable Output value.
- Select the Update item action from the action triggers to update the SharePoint list item, and configure the Sharepoint site, list name, ID, and Title value.
- In the Complete address field, pass the output value of the join action, so that the values will get updated in the list.
Save and test the flow. Here we will modify the selected item value so the flow will trigger.
Once the flow ran successfully like below, the value gets updated in list.
In the below screenshot, we can see the values are updated in the complete Address column as below:
This is another example to append multiple values in an array dynamically using the Power Automate flow.
Power Automate append array to an array variable
- No, it is not possible to append an array to an array variable.
- Power Automate append to an array variable action only supports the values of types ‘Float, Integer, String, Boolean, Object’.
In this Microsoft Power Automate tutorial, we have learned how to append multiple values to an array using Power Automate or Microsoft Flow. In addition, we also covered how to append an array to an array variable in Power Automate.
You may also like the following Power Automate tutorials:
- Power Automate Filter Array
- How to split a string into an array in Power Automate?
- Power Automate which exceeds the maximum nesting limit of ‘8’
- Remove unwanted properties from an object using Power Automate
- How to append a string to an array in Power Automate?
- How to count items in an array using Power Automate?
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com