Friday, September 11, 2020

Power Automate with SharePoint - 'Update Item' Action - Working with Multiple selection in PeoplePicker field

While updating an item in a list/library, we need to specify values for all or at the least mandatory fields.

However, specifying values for PeoplePicker fields, that too with Multiple selection becomes a tedious job. More so as the values to be selected in 'Apply To Each' loop are not directly available in the Dynamic content option.

To demonstrate an easy way to achieve this, I will start with a list - 'Department Details' with some regular columns like - DeptName, Address, and a PeoplePicker column named Associates.




We need to update the Status field based on presence of Address 1 values in the list. So, if Address 1 field is not empty, we need to update the Status field to ‘Valid’, else the default value is ‘Invalid’.

Now, create a new Flow using ribbon button for Automate.

As the Associates field is a Mandatory field, we need to specify values for this field too.

Initialize an Array variable – AssociatesArray


Add a new action – ‘Apply to each’, and in ‘Select an output from previous step’, select ‘Associates’ array field as shown below - 

It should be - triggerBody()?['Associates']



Add a ‘Compose’ action inside this ‘Apply to each’ loop, and add an array structure and ‘Claims’ value for the Associates field, as shown below:

The value should be - items('Appy_to_each')['Claims'] when you hover over it.


Add action – ‘Append to Array Variable’, and use the outputs from Compose action, as shown below – 


Insert a condition to check if Address 1 is not empty.

 


If Yes, then add ‘Update Item’ action, and specify all mandatory fields.

For Associates field, the Flow provides an option to manually enter the multiple person values.

 


However, we are going to use the array we created in previous step. Click on ‘Switch to input entire array’ as shown below –



I hope this post was helpful. For any other queries, please post comments.

I thank you for reading and look forward to seeing you on my blog next week!