Updating multiple people column with Power Automate

Starting a flow from a list or document library is possible using the “For a selected item” or “For a selected file” trigger in Power Automate.

When starting that flow, you can add the “Mail” field to insert multiple people. We want to update a multiple people column based on the input we provide here:

After running the flow, we want to save the approvers in an “Approvers” column (type person, multiple values) in the document library (or a list if you are not using a document library).

The way it won’t work

Adding the value of the trigger directly in the “Update” action does not work and returns errors:

The specified user personalwf95@personalwf95.onmicrosoft.com;jan.janssens@personalwf95.onmicrosoft.com could not be found.
clientRequestId: 73922c08-87af-4b70-a9b6-a27a73febe6d
serviceRequestId: 73922c08-87af-4b70-a9b6-a27a73febe6d

Updating the multipe people column in the correct way

Saving the multiple people into the multiple person column is only possibly by splitting the string of approvers into an array.

After that, you can loop through your array items, generate the necessary code and append it each time to a new array. This new array can serve as an input for the “Approvers Claims – 1” field in the above screenshot.

When you run the flow, you will see that the dynamic value triggerBody()[’email’] returns a string:

We want to separate this string and add it to an array using the split() function:

split(triggerBody()['email'], ';')

Second step is to initialize a second array variable that we will populate in the next steps:

Add an “Apply to each”. Select the first array variable “Approvers” of your flow in the “Select an output from previous steps” field:

Next, add a “Append to array” action. Put below code in the “Value” field.

Between the brackets, add dynamic value “Current item”.

{
  "Claims": ""
}

Add a “Compose” box to see the content of the “Approvers Claims” array variable:

You’ll see that we get a beautiful array with Claims objects in it. This is what we need as input for updating the multiple person column in the list or document library. You can delete this “Compose” action cause it’s just to show the output of the array variable.

In our “Update” action, click the icon to change the input field to switch to “Input entire array”:

Add the array variable with claims objects:

Run your flow and see your multiple person column being filled with all the people you specified in the trigger form.

The complete structure of the flow looks as follows:

Let’s hope that the Power Automate product team enhances this in the future so that we can easily update a multiple person column without doing all this complex “Claims” logic.

Leave a Reply

Your email address will not be published. Required fields are marked *