Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

How to avoid infinite trigger loop in Power Automate

Posted on October 11, 2020January 6, 2022 by Tom

“I’d like it to update a SharePoint item in Power Automate but I am getting a warning “Actions in this flow may result in an infinite trigger loop”.”

“This exact workflow design had no issues running in SharePoint Designer. Now all of a sudden, the same steps/logic in Power Automate result in this inadvertent looping.”

“Actions in this flow may result in an infinite trigger loop. Please ensure you add appropriate conditional checks to prevent this flow from triggering itself.”


In the past you maybe used 2010 or 2013 workflows (or Nintex workflow, which is using the 2013 workflow engine), and it was not possible to start multiple instances of a single flow on a single SharePoint item. But now, with the standalone Power Automate flows, such situations happen. Especially when you’re using trigger on ‘When an item is created or modified’ and you do an ‘update’ inside the flow. The Power Automate flow will end in an infinite trigger loop because of that update. What “conditional checks” should you add to avoid it?

Power Automate infinite trigger loop

Trigger condition

The best and most efficient way is to add a trigger condition inside the trigger settings. The trigger condition blocks the flow from starting if the condition is not ‘true’. You can not only avoid the infinite trigger loop with all the updates, but also save flow runs. No more empty flow runs.

The limitation is that you can’t use any ‘dynamic content’ and you need to define the condition in the old, type-it-all way (using column internal names).

Update: you can use the ‘Filter array’ action to create the trigger condition for you.

Power Automate trigger condition
Power Automate trigger condition

Trigger condition on ‘Modified By’ column

My favourite is to disable the flow run if the last update was done by a specific account (using its email address). It could be a service account, your account or somebody else’s account, whose connection the flow is using. If the item was updated by this account = it was done by the flow = don’t start it again. If it was modified by another account, start the flow.

@not(equals(triggerOutputs()?['body/Editor/Email'],'SPconnectionaccount@company.com'))

The limitation is that the account won’t be able to start the flow, ever. If you’re also user of the flow and you don’t have any other account, you can’t use this condition.

Trigger condition + version history check

One more approach I thought of (much) later, using trigger condition in combination with version history. I consider it the second best solution after having a separate account.

Trigger condition on two (or more) columns

If you can’t use the trigger condition based on the ‘Modified By’ column, maybe there’s a different column you could use. Some column updated by users. You can create a copy of that column, let’s call them ‘Column’ and ‘Column_copy’. Each update in the flow will update the ‘Column_copy’ = ‘Column’ to keep them synchronized. That means, the only situation when the columns will have different values is when it was updated by a user = run the flow.

@not(equals(triggerOutputs()?['body/Column'],triggerOutputs()?['body/Column_copy']))

With a coding knowledge you can build really complex conditions, using data from existing columns or fixed values. While you can add multiple trigger conditions, the operator is always AND. For OR operator you’ll need to put all the conditions into a single line. In the example below you can see the 2 conditions above combined with OR operator.

@or(equals(triggerOutputs()?['body/Editor/Email'],'SPconnectionaccount@company.com'),not(equals(triggerOutputs()?['body/Column'],triggerOutputs()?['body/Column_copy'])))

Update: you don’t need to stop with checking one column, you can check multiple columns and trigger the flow only if one of them is updated.

Condition action

Another option is to add a condition before each update. Check, if the flow should do an update, or if a previous instance of the flow already did it. For example, you need to update item status to ‘In approval’. You should add a condition before the update and do it only if current status is not ‘In approval’.

Power Automate condition

This approach is similar to the trigger conditions, with a few differences. Using the ‘Condition’ action:

  1. The flow will trigger on each update, that’s a lot of useless flow runs.
  2. On the other side, you can use data from other sources. Using the trigger condition you can compare only data from the trigger itself.
  3. You can use complex conditions without the coding knowledge.

Summary

I find the possibility of updating loops one of the most annoying things when using Power Automate. It’s easy to solve if you’ve got a separate account just for Power Automate or if you’re developing solutions for somebody else.

But if the flow is for your personal use, the workarounds get more complex. You need to manage ALL update actions in the flow, either by building complex trigger conditions or by additional ‘Condition’ actions. I still consider the trigger conditions a better solution, but I can understand it you decide to go with the ‘Conditions’ for its simplicity.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

12 thoughts on “How to avoid infinite trigger loop in Power Automate”

  1. SHAHINI A D says:
    May 21, 2021 at 3:22 pm

    I have tried this option but it still triggers the flow

    Reply
    1. Masud Ahmed says:
      January 29, 2022 at 4:42 am

      You have to change connection from update item control and send mail control. Set trigger mail address as connection .

      Reply
  2. Person of Interest says:
    June 10, 2021 at 1:25 am

    Which solution did you try?

    Reply
  3. Kris says:
    June 30, 2021 at 1:39 pm

    i tried
    @not(equals(triggerOutputs()?[‘body/Editor/Email’],’SPconnectionaccount@company.com’))
    with my account email of course instead SPconnectionaccount@company.com‘
    and it triggers, what am i doing wrong?

    Reply
    1. Tom says:
      July 5, 2021 at 8:13 pm

      Hello Kris,
      you can try to create the trigger condition from scratch with the ‘Filter array’ action, maybe it’ll help.

      Reply
  4. Bernhard Wyss says:
    July 16, 2021 at 3:12 pm

    Hi Tom
    I have the same issue as Kris and even used the Filter array to generate the expression. The strange thing is that I have older items in the list, for which the flow is not running. As soon as I update an item from the list for the first time, it is included in the loop.
    Thanks,
    Benno

    Reply
    1. Tom says:
      July 19, 2021 at 2:07 pm

      Hello Benno,
      I just tried it on my environment an it works as expected. Try to debug your flow by adding 2x ‘Compose’ action after the trigger, store the ‘Modified By Email’ in one of them and the email address in the other. That way you can check if the values are really equal in the flow run history, and adjust the trigger condition if needed.

      Reply
  5. SAN says:
    August 16, 2021 at 3:24 am

    Thank you so much , your trick about debugging worked for me. Really appreciate Tom.

    Reply
  6. Jan says:
    August 18, 2021 at 9:45 am

    Stupid that this option is hidden in a background menu.
    When you use a condition statement which does the same as the statement it will give these warnings all the time

    Reply
  7. Moataz says:
    October 4, 2021 at 3:06 pm

    Hello Tom,

    Thank you for your explanation. But what’s the point if the flow won’t re-trigger for a file change or modified, for example, if this person remodifies the document (after getting the approver’s comment, for example) I won’t be informed about his next changes?
    Is there any best way to do this?

    Thank you and appreciated,

    Reply
  8. kpkp says:
    September 14, 2022 at 7:36 pm

    The name of the account that last modified the list item is not in the body, so the trigger condition is not working. Is there something I am missing?

    Reply
    1. Tom says:
      September 18, 2022 at 7:18 pm

      Hello kpkp,
      try using the ‘Filter array’ action to build the trigger condition, that should make it reliable: https://tomriha.com/a-simple-way-to-create-a-trigger-condition-in-power-automate/

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

  • How to find Excel rows missing in SharePoint list (Power Automate)March 29, 2023
  • Check whether user exists in AAD with Power AutomateMarch 26, 2023
  • How to highlight whole SharePoint row based on calculated dateMarch 22, 2023
  • Why is your Power Automate flow running so slow?March 19, 2023
  • How to add multiple links to the Power Automate approval taskMarch 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes