Forum Discussion

Acorn999's avatar
Acorn999
Brass Contributor
Nov 18, 2022

Power Automate Trigger when SharePoint item created/modified endless loop

I have a SharePoint List and a Power Automate flow which is triggered when an item is added or modified in the SharePoint list. The power Automate flow modifies one of the values in the list item.

Because the Power Automate flow modifies an item in the list, this causes the flow to re-trigger because the item was modified. This causes an endless loop where the flow runs, modifies item, flow runs, modifies item, endlessly.

 

The flow owner is a Service Account, not an account which belongs to an actual user at my organization. We can refer to this account as 'serviceaccountusername'. This means if the flow Trigger Conditions expression could cause flow NOT to run when ['Modified By] is 'serviceaccountusername', it would solve my issue. 

 

To summarize what I need:

If the 'Modified By' value is 'serviceaccountusername', do NOT run the flow.

ELSE the 'Modified By value is NOT 'serviceaccountusername' RUN the flow.

 

What this accomplishes:

If the flow / 'serviceaccountusername' modified the item, don't trigger the flow.

If a real user modified the item, trigger the flow. 

 

Nothing I have tried accomplishes this:

 

 

(equals(triggerBody()?['Modified By'],'serviceaccountusername'))
flow runs but does not stop endless loop

@not(equals(triggerBody()?['Modified By'],['serviceaccountusername]))
Invalid expression, flow does not save

@equals(triggerBody()?['Modified By'],'serviceaccountusername',false)
causes flow not to run for ANY user

@not(equals(triggerBody()?['Modified By'],'serviceaccountusername',true))
flow runs but does not stop endless loop

@not(equals(triggerBody()?['Modified By'],'serviceaccountusername',false))
flow runs but does not stop endless loop

@not(equals(triggerBody()?['Modified By'],['Value'],'serviceaccountusername'))
Invalid expression, flow does not save

@not(equals(triggerBody()?['Modified By']?['Value'],'serviceaccountusername'))
flow runs but does not stop the endless loop

 

 

 

  • SvenSieverding's avatar
    SvenSieverding
    Bronze Contributor

    Acorn999 

    i use

    @not(equals(triggerOutputs()?['body/Editor/Email'],'<email of the serviceaccount>'))
    • Acorn999's avatar
      Acorn999
      Brass Contributor

      SvenSieverding 

       

      @not(equals(triggerOutputs()?['body/Editor/Email'],'<email of the serviceaccount>'))

       

      This code from you is successful. Solves my issue. Very appreciated!

  • Hi excel community, I am trying to generate map of Nigeria using MS Excel maps, all the states are highlighted except Adamawa state. What do I do?
    • RobElliott's avatar
      RobElliott
      Silver Contributor
      You've asked this in the wrong place. This is the SharePoint/Power Apps/Power Automate forum, not Excel, and you've asked it as a reply to someone else's question about something totally different.
  • Sean_DBA_0125's avatar
    Sean_DBA_0125
    Copper Contributor
    I have a question, I am using the when an item is modified trigger and the table is in sql server. I have a column named altered_AT which houses the timestamp there is a Stored Procedure that runs and compares current data to the data in a table and IF there is a change then update the table however apparently just querying the table updates the timestamp and then it runs literally every 10 seconds anyone else have an issue with this?

Resources