Set a people field in SharePoint with Power Automate when all you have is a user’s name.

Have you tried updating a people field in SharePoint? It can actually be very simple. 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.

Update a user field user Flow

Ok, this is simple enough. My run history shows that it all worked.

Update item worked and set people field in SharePoint

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.

an empty string using the trim function

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:

An Invalid user name

Microsoft flow has the Resolve Person action for this.

Resolve Person action

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

 

#Result of Resolve user action when user doesn't exist

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!

Update user flow

We need to set the Run after actions on the update item after the resolve person action.

 

Run after settings to ignore the failure

Once we have done that the flow will run successfully.

Showing the failed action but a successful flow

 

Other Posts about setting user fields

Get the user ID to update a people field in Microsoft SharePoint with Power Automate

 

Avatar of Pieter Veenstra

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/ Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/ You can contact me using contact@sharepains.com

Related Posts

3 thoughts on “Set a people field in SharePoint with Power Automate when all you have is a user’s name.

  1. What about when you get greater than 0:
    “Did not resolve to exactly one entity value. Number of values found: 3”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading