How to set a value in the User column of a SharePoint list in Power Automate with an email address, and how to set null.

Note how to set a value in the SharePoint user column from Power Automate by specifying an email address.

スポンサーリンク

Person or Group column

The Person or Group column of a SharePoint Online list is exactly what its name implies: a column where users or groups can be set.

This time, we will try to set up or empty a user for this person or group column using an email address from Power Automate.

Set users in the Person or Group column

From Power Automate, when setting up users in this person or group column, the property “Claims” must be set.

To set a user to this [Claims], simply prefix the user’s email address with “i:0#.f|membership|”,
When the flow is executed, the user is configured.

Set person or group column to null

Null assignment to [Claims] is not empty.

It is a bit difficult when you want to empty this person or group column and assign null to the [Claims] property,
flow is successful, though,
unfortunately, it is not empty.
So when emptying this person or group column, it is necessary to set null directly in JSON.

Set column values to null using JSON

The easiest way to allow JSON input in an SPO “Update Item” action is to define the list ID of the SPO list in a variable and set it in the action.

First, go to the listing cogwheel and press [Set Listing],
Note the list ID (in this case, “30a2d7a9-3829-4f00-83ac-9c9861f2e90f”) that appears between “%7B” and “%7D” at the end of the URL on the displayed screen.
Then you can define that list ID in a variable or create action and set it to the [list name] property of the “Update Item” action, and you can enter the value to be updated in JSON.
Finally, if you set null directly to the person or group column you want to empty (in this case, column “user”) and execute the flow,
the person or group column will be empty.

Extra: Using JSON to set person or group columns

When setting up a person or group column in this JSON-entry method, the Claims property must be set as follows.
{
    "Person or group column name":{
        "Claims": "i:0#.f|membership|{Mail}"
}
So, if you want to realize “set the user when an e-mail address is specified, and set empty when no e-mail address is specified” in an optional argument, etc., the following expression is used.

// Sample
If(equals({Variable or argument that contains the email address}, null), null, json(concat('{"Claims" : "i:0#.f|membership|',{Variable or argument that contains the email address},'"}')))

// In this case
If(equals(triggerBody()?['text'], null), null, json(concat('{"Claims" : "i:0#.f|membership|',triggerBody()['text'],'"}')))
If the Email is empty when the flow is executed,
the person or group column will be empty,
When you set up your email address,
The user is set.

Related Articles

タイトルとURLをコピーしました