cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bdc604
Advocate III
Advocate III

How to patch a multi-person field from one SharePoint list to another?

I would like to patch a multi-person field in one list with the values of a multi-person field in another list.

 

patch rfi.PNG

Tried pulling from list directly, keeps sticking it in apply to each.

Tried creating an array variable, doesn't show up to insert into body.

Is there not a way to do this in one shot?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @bdc604 ,

 

If you want to patch the item from List1 to List2, please check the following flow for a reference.

 

Before we create multiple users with Rest API, we need to get the User Principal ID for that.

 

So we need to use two Send an HTTP Request to SharePoint actions, one for getting the User ID, one for creating the item in a list.

 

Besides, we also need to initialize variables for the User ID.

 

After the trigger, add action Initialize variable, Name to Id, Type to Array.

 

Within the apply to each, add action Append to array variable, set its value to the following code:

 

body('Send_an_HTTP_request_to_SharePoint')['d']['id']

 

 

Under the Apply to each, add a Compose action, set its value to:

variable('id')

 

 

Then the last Send an HTTP request to SharePoint action to create the item in another list.

Configure the Body likes below:

 

{

  "__metadata":{type:"SP.Data.List33ListItem"},

   MpersonId:{'results':@{outputs('Compose')}}



}

 

 

1.PNG2.PNG

 

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yamao-msft
Community Support
Community Support

Hi @bdc604 ,

 

To save multiple person column value from one list to another, please check if the following way will work for you.

 

Add trigger When an item is created in List33.

 

Initialize variable, Name: Test, Type: String.

Initialize variable2, Name: Test1, Type: String.

Initialize variable3, Name: Test2, Type: String, Value: ;

 

Add Apply to each, select from the multiple selection enabled person or group column.

 

Within the Apply to each, add the following actions:

Set variable: Name: Test2, Value: variables(‘Test1’)

Set variable2: Name: Test, value: dynamic content Mpwerson Email from the trigger.

Set variable 3: Name: Test1, value: concat(variables('Test2'),';',variables('Test'))

 

Under apply to each, add action Create item to create the item in another list11. Select dynamic content variable Test for the Mulperson Claims field.

1.PNG2.PNG3.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
bdc604
Advocate III
Advocate III

Patching, not updating using update item. More like this...

 

{
'__metadata': {'type': 'SP.Data.SettingsListItem'},
AdminsId: {'results': [24,25]}
}

 

Problem 2: I can get my admins as an array, but converting to string using compose is problematic.

Compose produces {"Id":24},{"Id":25} instead of the numeric string I need as shown above.

Hi @bdc604 ,

 

If you want to patch the item from List1 to List2, please check the following flow for a reference.

 

Before we create multiple users with Rest API, we need to get the User Principal ID for that.

 

So we need to use two Send an HTTP Request to SharePoint actions, one for getting the User ID, one for creating the item in a list.

 

Besides, we also need to initialize variables for the User ID.

 

After the trigger, add action Initialize variable, Name to Id, Type to Array.

 

Within the apply to each, add action Append to array variable, set its value to the following code:

 

body('Send_an_HTTP_request_to_SharePoint')['d']['id']

 

 

Under the Apply to each, add a Compose action, set its value to:

variable('id')

 

 

Then the last Send an HTTP request to SharePoint action to create the item in another list.

Configure the Body likes below:

 

{

  "__metadata":{type:"SP.Data.List33ListItem"},

   MpersonId:{'results':@{outputs('Compose')}}



}

 

 

1.PNG2.PNG

 

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-yamao-msft ,

 

I tried your approach but i got below error when trying to create item with http send request method

 

"message""An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected.\r\nclientRequestId: f25778bf-37e5-4163-9a9c-1d4b99af9fe5\r\nserviceRequestId: a935439f-2006-0000-562b-82fcdcdfb505",
 
Body :
{
'__metadata': { 'type': 'SP.Data.ListBListItem' },
"Title": "Title",
MultiUserId:{'results':[{"d":{"__metadata":{"id":"https://XXXXXXXXXXXXXXX.sharepoint.com/sites/XXXXTest/_api/Web/GetUserById(14)","uri":"https://XXXXX... (Contractor)","PrincipalType":1,"Email":"User1@ABCD.com","Expiration":"","IsEmailAuthenticationGuestUser":false,"IsShareByEmailGuestUser":false,"IsSiteAdmin":true,"UserId":{"__metadata":{"type":"SP.UserIdInfo"},"NameId":"10030000ab6718f1","NameIdIssuer":"urn:federation:microsoftonline"},"UserPrincipalName":"User1@ABCD.com"}},{"d":{"__metadata":{"id":"https://XXXXXXXXXXXXXXX.sharepoint.com/sites/XXXXTest/_api/Web/GetUserById(299)","uri":"https://XXXX... (Supplier)","PrincipalType":1,"Email":"User2@ABCD.com","Expiration":"","IsEmailAuthenticationGuestUser":false,"IsShareByEmailGuestUser":false,"IsSiteAdmin":false,"UserId":{"__metadata":{"type":"SP.UserIdInfo"},"NameId":"1003bffda5c4d533","NameIdIssuer":"urn:federation:microsoftonline"},"UserPrincipalName":"User2@ABCD.com"}}]}
}
 
Thanks
Sith
avsmillar
Frequent Visitor

I have been struggling with using this solution for my flow for two days.  I am stumped.  I have a list "Active" that has two multi-person columns.  When the "status" list item column is changed to "completed", I want to migrate the item to an "Archive" list.  I have used the standard to create a list item from another list item and then the delete list item function to remove it from the "Active" list.  However, when creating a list item from any existing list item where there are multiple people in a "Person or group" column, it creates a separate list item for every person.  I just want the exact same list item with all people in the one "person or group" column.  Can anyone help?  I have added an image of the entire flow and then another of just the "create" action.Archive flow.pngCreate item flow.png

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,187)