I have 2 sharepoint lists. When a user creates an item is created in List 1 I have a Microsoft Flow that creates an item in List 2. The workflow also stores the ID of the item in List 1 as a number column in List 2 and stores the ID of the item in List 2 in a number column in List 1. This way it is easy to see which items are related in each list. This gives me a virtual one-to-one relationship.
When the item in List 1 is changed I want to update some columns in the related item in List 2. How can I get the related item in List 2. I thought I would simply be able to use the 'SharePoint Get Item' using the ID number stored in List 1 to get the correct List 2 item, but I don't see how?
What am I missing? Do I have the wrong approach?
Please consider to add a Condition in the flow to check if the ID in List1 is equal to the ID Column in List2.
According to your description, I create two Lists, List1 and List2. There is a Number column named List1ID in List2 which is used to store the ID of the item in List1.
The flow is configured looks like below. If the ID is equal to List1ID, update item in List2. In the Update item action, configure the Id and List1ID field with the dynamic content ID from the trigger “When an existing item is modified”.
Hope this could be a reference for you, please try if this will work for you.
Thanks for the solution. That's what I ended up doing.
My frustration came from the SharePoint Get Item action (as opposed to the Get Item's' action), which seems to offer the chance of finding a specific item in a list, but doesn't really. Is there an underlying reason for there being no ability to add a simple 'where' condition to make sure the flow gets the right item from a list?
An additional complication is that I am working with imported data and wanted to set a condition where, if List 1 doesn't have an entry for a related List 2 item, the flow creates a new item in List 2 and updates the relative IDs in both lists. I failed to find a successful way to branch either to updating the related record in List 2 or creating a new one. The columns holding the ID of the related item is null when the list imported. The condition, like the one you illustrate, to update the existing List 2 item is straightforward, but I failed to find a condition that successfully branched based on a null value in the column in List 1 holding the IDs of related List 2 items.
For clarity, the flow I was trying to create went like this:
Condition: 'IDList2 in List 1' is null (this is where I failed)
Yes: Action: Create new item in List 2 and update related ID information in columns in Lists 1 and 2
No: Condition: 'IDList2 in List 1' = List 2 ID
Yes: Action: Update List 2 item
No: Do nothing
My workaround was to change the null values in the IDList2 column to 0 so the first condition is now:
'IDList2 in List 1' = 0
This works. However, I would be pleased to know if it is possible to filter out null values from a SharePoint number column using a condition in Flow. I couldn't get @empty(... to work here either.
As an aside, is there a comprehensive guide or reference for Microsoft Flow? Searching seems to turn up tidbits, but nothing compiled.
Thanks for your solution.
A documentation for Microsoft Flow is:
You could get more details about Flow at here.
Also, Workflow definition language is also useful when configuring a flow:
Join us for the first ever Power Platform Online Conference!
Look out for new contribution recognition badges coming SOON!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!