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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,995)