I faced an issue recently which was kind of an oversight when I look back now. However, there is one small trick which I learned or noticed which can save someone some time and a bit of frustration if you don’t see that small option. So, let me share that with you today. But first, lets set up the context to reproduce the problem.
I created a simple custom list. Add a people picker column with these two configurations:
- Make the field required
- Allow multiple selections
Add a choice column called Status with just 2 options
Now, lets create a new item. Ensure that you add multiple users in the people picker field(Users).
Below image shows how the list looks like after the item has been added. We can see 3 people are added to the people picker field and Status is set to Submitted by default.
Now, lets create a flow which will set the status to Completed. Pretty simple requirement. However, we need to remember that the People picker is a required field. So, we need to set a value to this field.
Here, we can see that if the people picker field is left empty, it gives an error.
So, here I have added a get item which will retrieve all the values for the User field. In this case it has 3 items. If I try to set the claims to the claims of the get item, Flow automatically puts a loop around this activity. So, for each of the 3 items, we update the claims.
But this is the problem. Every time, we set the claims, it replaces the previous value, it does not append. If we need to manually append, we have to construct a json object with each claims value. However, there is a simpler way. This is what I wanted to share with you.
Solution / Trick: There is small button next to the User Claims field. If you hover on it, it says ‘Switch to input entire array’. If you click on it, it changes it’s icon and we can input the entire array.
Changes to this..
In this mode, we can take the value which we got from the get item (which contains all 3 items) and set it in the update item. Now, it doesn’t create the loop around it.
Thats it! Let me know if you found this helpful or interesting. Or what you are interested in reading about. Cheers!