cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
henkerunesson
Frequent Visitor

GET Items from one list POST to another, diffrent sites, diffrent user id's

In my flow I use Send an HTTP request to SharePoint (GET) _api/web/lists/getbytitle('ListA')/items

And part of the body looks like this:

"assigned": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@@odata.type": {
"type": "string"
},
"Claims": {
"type": "string"
},
"DisplayName": {
"type": "string"
},

In the next step I use Parse JSON and use the same as the body above.

And in the output i get a result that looks like this:

"assignedStringId": {
          "__metadata": {
            "type""Collection(Edm.String)"
          },
          "results": [
            "12",
            "13"
And this is a Person/Group field allowing multiple persons.
Then I use a HTTP request POST to another list, and in the body I use
'assignedId': {'results': items('Apply_to_each')?['assignedId']?['results']
This gives me the correct output with the assigned user id from ListA, but the list Im updating (ListB) is located on another site, so the users dont have the same ID, so for example the ID nr 13 on site where ListA is located the ID belongs to John Doe, but on the site where ListB is located its Jane Doe.
 
I tried adding a HTTP request using _api/web/siteusers to get the user email from the site where ListA is located and use that insted in the POST to ListB but cant figure out how to achive this when its multiple id's involved in the output.
 
In the list the field is "Field=assigned" and from the JSON parse I get a dynamic content "DisplayName" or "Claims" or "Email"
for ex body('Parse_JSON')?['items']?['properties']?['assigned']?['items']?['properties']?['DisplayName'] and if I try using that the Flow runs and then break with Error Details: A 'PrimitiveValue' node with non-null value was found when trying to read the value of a navigation property; however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected.
 
Any help appreciated!
2 REPLIES 2
v-LilyW-msft
Community Support
Community Support

Hi @henkerunesson 

Do you want to copy items from ListA to ListB? You can try to use Get items and Create item action to achieve it.

I set up a simple flow , you can refer to the screenshots below to see if it helps.

This is my test ListA

vLilyWmsft_2-1637218353997.png

Another list 

vLilyWmsft_3-1637218394680.png

Flow in details:

vLilyWmsft_1-1637218308644.png

Assigned Claims Field, first choose 'Enter custom value',then choose 'Assigned Claims' from the dynamic content. 

vLilyWmsft_6-1637218599549.png

vLilyWmsft_4-1637218455456.png

After flow runs, the items will be created in 'ListB'.

vLilyWmsft_5-1637218511012.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

henkerunesson
Frequent Visitor

Hi @v-LilyW-msft 

Thanks for reply!

 

Im using this solution today (copy items), and its working but I would like to improve it.

Today I have 7 lists where users update information and with Flow I update all information to one masterlist for managers to monitor.

In current solution when an item is updated, we remove all items in the masterlist that is coming from that "sublist" and then resend them, but the flow is not quick enough so if the user updates two items within a couple of seconds the flow repost all items twice.

Maybe I could look into adjust the current flow to not remove all items insted just send the update, but when I started to look in to this I found I way to use the API and do batch updates which is a much faster procedure.

In the new Flow Im creating everything works, except for the "assigned" field and I wanted to give it a try and find a solution before I go back and adjust the current flow.

 

Best regards

Henke

Helpful resources

Announcements
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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,168)