Power Automate With SharePoint - 'Update Item' Action - Working With M

Introduction 

 
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 with Multiple selections 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.
 
Power Automate With SharePoint - 'Update Item' Action - Working With M Power Automate With SharePoint - 'Update Item' Action - Working With M
 
We need to update the Status field based on the presence of Address 1 values in the list. So, if the 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 the ribbon button for Automate.
Power Automate With SharePoint - 'Update Item' Action - Working With M
 
As the Associates field is a Mandatory field, we need to specify values for this field too.
 
Initialize an Array variable – AssociatesArray
 
Power Automate With SharePoint - 'Update Item' Action - Working With M
 
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']
 
Power Automate With SharePoint - 'Update Item' Action - Working With M
 
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.
 
Power Automate With SharePoint - 'Update Item' Action - Working With M
 
Add action – ‘Append to Array Variable’, and use the outputs from Compose action, as shown below.
 
Power Automate With SharePoint - 'Update Item' Action - Working With M
 
Insert a condition to check if Address 1 is not empty.
 
Power Automate With SharePoint - 'Update Item' Action - Working With M

If Yes, then add ‘Update Item’ action, and specify all mandatory fields.
 
For the 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 the previous step. Click on ‘Switch to input entire array’ as shown and select the array variable we populated.
 
Power Automate With SharePoint - 'Update Item' Action - Working With M
 
Save the Flow and run to test it. The values in the peoplepicker field is populated successfully.
 
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!