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

Library and sister SP List - Check if item exists, retrieve ID for item update

I'm struggling with this - I have a Document Library with some custom columns, one being a unique identifier (not the ID column)

 

I want to check a separate List to see if that unique identifier exists (same column name in both places) and if it does, give me the ID of that list item so that I can use 'update item' next...

 

and if it doesn't exist, use 'create item' with the thought that future updates to that newly created item would match the identifier already in the library and use 'update item' for subsequent changes.

 

I have gone through about 30 articles now and I don't know how to *extract the list ID for that item* if there is a match, so I can update it with information from the library's columns (mirrored.)


Please let me know if you need further information, thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ScottShearer
Super User
Super User

@EasternSeaboard 

The ID of the item is available to you from Dynamic properties under Get items.

You'll loop through the item(s) returned from Get items and have an update item action inside the loop that referenced the ID.  The Loop will be on one side of your condition.

image.png

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

Scott

View solution in original post

5 REPLIES 5
ScottShearer
Super User
Super User

@EasternSeaboard 

To check the SharePoint list, use a Get items action with a filter query that will limit the rows you get back to those that meet your criteria.  Here is a link for more info on creating filter queries.

To find out if any rows are returned, use the length() expression.  If length() is greater than zero, you had a match

image.png

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

Scott

Thanks - that is what I've done, however I need to then update the specific row returned, if it exists. How do I get its ID? I need more than true or false returned, or rather if true is returned, I need to know what the list item ID is.

ScottShearer
Super User
Super User

@EasternSeaboard 

The ID of the item is available to you from Dynamic properties under Get items.

You'll loop through the item(s) returned from Get items and have an update item action inside the loop that referenced the ID.  The Loop will be on one side of your condition.

image.png

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

Scott

Seems like that's all I was missing (aside from the length expression) - will try it out. Thanks!

So I didn't have the filter query setup correctly (including the column name and 'eq') and had some issues as some columns were not populated, but now with data in them all and the filter query fixed, this is working. Thanks again!

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.

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (2,791)