Stop Wasting Hours: Power Automate People Picker REST Fix

C
Collab365 TeamAuthorPublished Jan 29, 2021
2

At a Glance

Target Audience
Power Automate Developers, SharePoint Admins
Problem Solved
Failing to update SharePoint People/Group fields in Power Automate due to no native action; incorrect REST API payloads for user IDs.
Use Case
Automating requester, manager, and multi-assignee updates in SharePoint lists for workflows like approvals or task assignments.

Most developers waste hours trying to update SharePoint People Picker fields in Power Automate. They look for a native drag-and-drop action. It never works. There is no native Power Automate action for grabbing a direct SharePoint site user ID by their email. You have to build an HTTP request.

Stop fighting the system. Speak SharePoint's language instead.

When you use the REST API, People and Group fields do not care about email addresses. They only care about the internal user ID. The API returns these fields formatted as FieldNameId.

Here is the exact format you need to memorize.

For a single-valued user field, the payload is 'FieldNameId' : UserID.
For a multi-valued user field, you need an array. The payload is 'FieldNameId' : { 'results': [ArrayOfUserIDs] }.

What happens when you need to clear a field? You cannot just pass a blank value.
To empty a single-valued field, pass -1.
To empty a multi-valued field, pass an array with a zero like this: {'results': [0]}.

Let us build a Flow that actually works. We are going to update three specific fields.
The Requester field gets the ID of the person who modified the item.
The Manager field pulls the requester's manager. If they do not have one, we set it to empty.
The Assigned To field is a multi-value picker. We will pull an array of users from another list. If it comes back empty, we clear the field.

Step 1: Initialize Your Variables

You do not technically need variables to make this work. But hardcoding everything inside an HTTP request is a great way to build an unreadable mess. Variables keep your Flow clean.

Step 2: Retrieve the User IDs

You need the internal SharePoint ID for your users. Since Power Automate lacks a native action for this, we use the REST API. The SiteUsers/getByEmail endpoint is widely used in Power Automate contexts for exactly this reason.

Grab the Requester ID

Call this endpoint to get the site user information:
_api/web/SiteUsers/getByEmail('UserEmail')

Grab the Manager ID

Next, we find the manager for the requester. If the manager exists, we grab their ID. If not, we pass our empty value.

Grab the Assigned To IDs

Finally, we pull the array of users for the Assigned To field.

Step 3: Send the HTTP Request to Update the Item

This is where everything comes together. We use the "Send an HTTP request to SharePoint" action. This follows standard SharePoint REST update practices.

Configure your action exactly like this:

Method: POST
Uri: _api/lists/getbytitle('@{replace(variables('ListTitle'), ' ', '%20')}')/items(@{int(triggerBody()?['ID'])})

Headers:

{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose",
  "X-HTTP-Method": "MERGE",
  "IF-MATCH": "*"
}

Note: If you are creating a new item instead of updating an existing one, remove the X-HTTP-Method and IF-MATCH lines.

Body:

{
  "__metadata": {
    "type": "SP.Data.@{replace(variables('ListName'),' ','_x0020_')}ListItem"
  },
  "RequesterId": "@{variables('RequesterId')}",
  "ManagerId": "@{variables('ManagerId')}",
  "AssignedToId": @{variables('AssignedToId')}
}

Notice that AssignedToId does not have quotes around the variable. That is intentional. It expects an array object, not a string.

That is the process. No magic. Just learning the exact syntax SharePoint demands and applying it consistently.