How to append multiple values to an array in Power Automate?

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.

Power Automate append to array multiple values
  • 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.
How to append multiple values to an array in Power Automate
  • 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.
append multiple values to an array using Power Automate

To see the output, add a compose action and pass the initialized variable. Save the Power Automate flow.

See also  Power Automate IF Expression [With 51 Examples]
append multiple values to an array in Power Automate

Run the flow manually and pass the values and click on the Run flow option.

Append multiple values to an array in Power Automate example

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:

Append multiple values to an array in Power Automate flow

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
append multiple values dynamically using Power Automate

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.
append multiple values dynamically using the Power Automate
append multiple values dynamically using the Power Automate
  • 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.
Example to append multiple values dynamically using Power Automate
  • 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.
append multiple values dynamically using Power Automate flow
  • 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.
Example to append multiple values dynamically in an array using Power Automate
  • 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.
Append multiple values dynamically in an array using Power Automate flow

Save and test the flow. Here we will modify the selected item value so the flow will trigger.

Append multiple values dynamically in an array using Power Automate

Once the flow ran successfully like below, the value gets updated in list.

append multiple values to an array in Power Automate

In the below screenshot, we can see the values are updated in the complete Address column as below:

Append multiple values dynamically in array using Power Automate flow

This is another example to append multiple values in an array dynamically using the Power Automate flow.

See also  Power Automate delete emails older than [15 days example]

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:

>