Power Automate, avoid looping when working with SharePoint list

In Power Automate when we use a flow to get items from SharePoint Lists, following actions tends to be get wrapped automatically in a loop.

In larger flows, this tends to complicate the whole flow and make it difficult to manage. Espessially when we use the the ODATA filter query to restrict the entries returned to the one we want to work with further in the flow.

The trick to avoid this loop, whenever you know that your query always return only one time is to use the expression first()

In your flow, create a new int variable name it itemID, after the “Get items” action create a set variable using the following expression:

first(outputs(‘Get_items’)?[‘body/value’])[‘ID’]

The example is getting Item ID value, but it can be other values you want to use from the query, play around until you find what you need.

Save the flow and run it, the following “Update item” actions should be running without the loop.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s