cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elleeyl
Helper III
Helper III

Flow to update column value from another SharePoint list

Hi Community,

 

I have a SharePoint list "1" and SharePoint list "2". 

SharePoint list "1" has a HeaderID column, and SharePoint list "2" has a HeaderID and a LineID column. Both lists have a Status column.

 

When I create an entry e.g. market in SharePoint list "1" , it will have a HeaderID of 1.

In SharePoint list "2", it holds details of entry in SharePoint list "1", so in this example, it will be talking about what I bought in the market. Let's say I bought an apple, in SharePoint list "2", the HeaderID would be 1 (HeaderID always follows the ID of the header record in SharePoint list "1), and LineID would be 1. Then I bought an orange which creates another line item in SharePoint list 2 and now, HeaderID of the orange item is 1 and LineID is 2.

 

How do I create a flow such that an update of an header item in SharePoint list "1" status will update the status column of ALL items having the same HeaderID to the same status in SharePoint list "2"?

 

Thank you.

6 REPLIES 6
manuelstgomes
Community Champion
Community Champion

HI @elleeyl 

 

I think I can help you with this. First, we need a trigger that finds the items that are changed:

Screenshot_2019-12-16_at_09_52_40.jpg

 

Then we need to check if the item was updated or created. We want only the updated ones so we compare the Created and Modified and if they are different then you know it's an update.

Next, we fetch only the values we want to update. That's where the "Filter Query" comes into play. Then it's just a question of updating the items from SharePoint list 2 with the values that you want. 

 

Here's the Power Automation

Screenshot_2019-12-16_at_09_51_56.jpg

 

 

Makes sense? If something is not clear please let me know and we'll try to figure this out.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Hi @manuelstgomes ,

 

Thank you for your  help. I am getting there but I have 1 more issue.

 

My HeaderID is not the same value as ID that gets generated by SharePoint. The status needs to be updated based on HeaderID value, so if I for example update HeaderID 33, two line items should be updated. 

 

Capture.PNG

 

Perhaps the way I'm doing it is wrong, but when I specify HeaderID (i.e. 33) under ID, it will update ID 33 and not HeaderID 33.

When I specify ID as ID, it will update the wrong line item as well. 

 

2.png

 

Kindly advise. Thanks.

Hi @elleeyl 

 

You're almost there. 🙂

In the ID column, use the ID from SharePoint not the HeaderID. The HeaderID is only used to filter in the "Get Items".

 

Since the fields are mandatory, Power Automation requires that you fill them in when doing an "Update Item", but you can use the same values and keep the values that you want unchanged.

 

So just select the ID from when you do the "Get items" from the "Details 3" and update the status as you're doing now. 

 

That will fix it :).

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Hi @manuelstgomes ,

 

Sorry, I need more help on this.

 

I have entered the following under Get Items and Update Item

2.PNG

3.PNG

 

Under Get Item, it is returning HeaderID as 52 (which is the SharePoint), which is wrong. It should be 34.

1.PNG

 

I have tried to use ID eq HeaderID under Get Items, and it returns ID as 34 which is correct. However it will then tried to update SharePoint ID 34, instead of HeaderID 34.

 

Thank you for your patience and guidance. Thank you.

May I know if anyone can help me with this please? Am stumped badly here. Thank you.

Hi @elleeyl 

 

The formulas and strategies are correct. If you're getting the incorrect number is because you're probably fetching the ID from the wrong list.

 

Please check the following:

  1. If the ID fields come from the correct SharePoint lists. It's easy when picking them, to select one from a different list. 
  2. If the HeaderID is a number you don't need the ' in the formula. Just do it HeaderID eq ID.

 

Could you please double check this?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

I'm sure is just a question of wrong fields being queried

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,284)