Showing results for 
Search instead for 
Did you mean: 
Not applicable

Condition on "Get Item" action (sharepoint)



In my flow I have a "get item" action based on ID

And I want to put a condition in this action : 


If it finds no item : create an item with the ID 

Else : update the item


I launch my flow but when it don't find item the "get item" return an error ... "item not found"




It doesn't go to the next step (condition)




The condition is : length(outputs('Get_items')?['body/value']) is equal to 0

If the length is 0, the item doesn’t exist yet, I can create it. If it’s not 0, the item already exists and I can use the ID from ‘Get items’ to update it.


But the flow failed when he doesn't found item in the "get item" action ...

Super User
Super User

Hi @Anonymous,


Because there is no value field in the body you can't check for its length. I would use a slightly different approach. You can first check for the statuscode of the output and if the error message starts with Item Not Found. If that is the case you could create the item.


Below is an example of that approach.





is equal to 404







starts with Item Not Found



And also make sure you configure run after has failed in the settings of your Condition action btw.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter

Helpful resources

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,809)