How to avoid an endless loop in Power Automate


A well-known problem with Power Automate is the infinite loop when using the SharePoint "when created or modified" trigger.

The error occurs when a user who created an item starts the flow that will modify that same item and in this way the modification will enter in an infinite loop.

How to solve it


a screenshot of a cell phone

Using Power Automate's best practices, the first step is to create an environment variable containing the service user.


Then create a variable with the system account email.


Now, in the trigger settings, use the following instruction.

@not(equals(triggerOutputs()?['body/Editor/Email'], parameters('itRobot (new_itRobot)')))


If you are not using environment variables, just pass the email as a string instead of the environment variable.

 
@not(equals(triggerOutputs()?['body/Editor/Email'], 'itrobot@torpedo.pt')

TIP:

parameters('itRobot (new_itRobot)')​​​​​​​ and triggerOutputs()?['body/Editor/Email'] are values ​​that can be obtained by defining a dynamic variable from the item editor. Then just copy this variable and paste it in any text editor or in your browser's URL and this value will be displayed in text. The same applies for System Account using a compose for example.

Copyright © 2019 Torpedo. All Rights Reserved

Powered by Kentico CMS | Cookie Policy

By using our website you agree to our cookies policy. Read More Close