Have you tried updating a people field in SharePoint? It can actually be very simply. In my case all I had was a list of firstnames and lastnames of the people and I needed to update a list of items in SharePoint.
I will skip the reading the data for simplicity sake. I will start by setting a compose action to my first and last name.
Ok, this is simple enough. My run history shows that it all worked.
But now imagine that I have no user in some of my data. In my case the user field is not a required field. To simulate this I’m setting my compose to an empty string.
This will result in an error. Ok, this is easy enough to resolve. Just check for an empty user name and only do the update when the account is not empty.
“message”: “The specified user could not be found.\r\nclientRequestId: fd85ac1f-45b7-4c79-a9e6-8bc752746163\r\nserviceRequestId: f5709f9e-0079-0000-3740-57e8a2a27178″
Now the final challenge, how to handle invalid user accounts. I set my user account to John Johnson, and I’m getting the expected warning:
Microsoft flow has the Resolve Person action for this.
Note that before you can select the Column you will first have to select the view. It is a bit annoying that this option is available under the by default hidden advanced options. But this still doesn’t solve the problem. Invalid users will give the
Did not resolve to exactly one entity value. Number of values found: 0
So we still need to do some more work! The flow below will work for existing accounts but not for invalid accounts. Did you consider conditions? Well you should not!
We need to set the Run after actions on the update item after the resolve person action.
Once we have done that the flow will run successfully.