web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Need help to compare the list items and then do an action based on the output.

(0) ShareShare
ReportReport
Posted on by

Hi All,

 

Flow Details: I am having a flow that gets the data from email and create a item in SPO List. And the column names are Record Number, City, Country and so on. I was getting multiple emails for one record number and at that time the flow need to check If the record number is existing or not in the SPO list.

Actions:

  • If the record number is already exists in the list, then need to just update the Column values
  • If the record number is not found, then need to create an item in the list.

Any suggestions on the condition part..

Thank you.

             

I have the same question (0)
  • Verified answer
    henkenTech Profile Picture
    135 on at
    Re: Need help to compare the list items and then do an action based on the output.
    • When you get your items, add an OData filter for the Record id (ColumnName eq 'RecordId').
    • Then, in your condition, count the returned items using the length() function and use the greater than condition with a 0 on the other side. When the item is not yet in the list, the No branch of the condition will be activated and the other if the item is already in the list.
    • Then, use a Create Item and Update Item respecitvely.

    Hope this help 🙂

  • Verified answer
    Ellis Karim Profile Picture
    11,469 Super User 2025 Season 2 on at
    Re: Need help to compare the list items and then do an action based on the output.

    For the record number, you should check that the SP list ensures that there are no duplicate Record numbers:

    ekarim2020_5-1625414759242.png

    It probably needs to be a required field too:

    ekarim2020_7-1625414968866.png

    Filter query can be used to Get Items (uses oData filters to construct the query):

    ekarim2020_2-1625414153320.png

     

    Use a condition to check to see if any records are returned:

    If length(outputs('Get_items')?['body/value']) is greater 0 - that means a record was returned by the filter:

    ekarim2020_12-1625416775395.png

     

    Note that even though only one record is returned, Get Items returns an array, which Power Automate will need to cycle through, hence the use of Apply to each loop.
     
    I hope this helps.

     

    Ellis

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 647 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 350 Moderator

#3
developerAJ Profile Picture

developerAJ 256

Last 30 days Overall leaderboard