cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anorakman
Level: Powered On

Get Specific Item from a SharePoint List based on a value in another list

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?

3 REPLIES 3
Community Support Team
Community Support Team

Re: Get Specific Item from a SharePoint List based on a value in another list

Hi Anorakman,

 

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

3.PNG

 

Hope this could be a reference for you, please try if this will work for you.

 

Best regards,
Mabel Mao

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.
Highlighted
Anorakman
Level: Powered On

Re: Get Specific Item from a SharePoint List based on a value in another list

Thanks Mabel

 

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.

 

Anorakman

Community Support Team
Community Support Team

Re: Get Specific Item from a SharePoint List based on a value in another list

Hi Anorakman,

 

A documentation for Microsoft Flow is:
https://flow.microsoft.com/en-us/documentation/getting-started/

 

You could get more details about Flow at here.

 

Also, Workflow definition language is also useful when configuring a flow:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

 

Best regards,
Mabel Mao

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.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 112 members 4,507 guests
Please welcome our newest community members: