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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Error when using Get I...
Power Automate
Answered

Error when using Get Items to query a list

(0) ShareShare
ReportReport
Posted on by 55

Hello Guys, Hope You can help with this one. 

 

I have a flow that needs to check if an item already exist on a Master list, if the item exist then update it, if it doesn't exist then create the item. 

 

The issue I have is when I use a "Get Items" to query the "Master List" it goes through every single item in the "Master List" checking if the values match, if they don't match then it creates the item, BUT then it moves to the next item and it tries to create it again, and again for each item it checks. it seems that is not checking the entire list and choosing to create the item or update it after it checks the list. It does this 100 times and then it fails because some of the values are unique.Flow1.JPG 


 Flow2.JPGFlow3.JPG

 

Categories:
I have the same question (0)
  • PieterVeenstra Profile Picture
    13 on at
    I've created a post on this. earlier this week. https://veenstra.me.uk/2018/12/03/microsoft-flow-import-list-data-from-an-excel-spreadsheet-into-sharepoint-lists/ To do this include a query in your get items. Then check for the number of items found then have a condition that either creates or updates the lists items.
  • DemoMan Profile Picture
    55 on at
    Hi Pieter, Thanks so much for your reply. I see that you are using the: @equals(length(body(‘Get_items_2’)?[‘value’]), 0) I'm using a similar string on my flow: @equals(length(body('Get_items')?['value']), 1) But I'm not sure this works for me, my flow checks the first item on the list for the value I'm looking for and when it sees that is not the same value I'm looking for it creates my item, it then moves to the next item and it sees that the item doesn't have the value I'm looking so it tries to create the item again, only that this time it fails because the item was already created on the flow's first run. Does your flow check all items until it finds the one that matches your value and then stops?
  • Verified answer
    PieterVeenstra Profile Picture
    13 on at
    The selection of the item in Get_Items ( using the filter field in the advanced settings) sorts out that I will only get 1 item or no items back. Checking for 0 might not work as a list of no items might mean that the length function will fail. What will length (null) return? In general I add a few compose actions to my logic so that I can debug the solutions. Can you add 2 compose actions just before your condition. set the first compose to the following expression: body(‘Get_items_2’)?[‘value’] and the second one to: length(body(‘Get_items_2’)?[‘value’]) Now you will know what the values are that are failing.
  • Verified answer
    v-yuazh-msft Profile Picture
    on at

    Hi @DemoMan,

     

    I have made a test on my side, please refer to screenshot below to create the flow:

    Capture.PNG

    Capture.PNG

     

    Best regards,

    Alice

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard