SOLVED

Power Automate Trigger when SharePoint item created/modified endless loop

Occasional Contributor

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

 

 

 

4 Replies
best response confirmed by Acorn999 (Occasional Contributor)
Solution

@Acorn999 

i use

@not(equals(triggerOutputs()?['body/Editor/Email'],'<email of the serviceaccount>'))
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?
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.

@SvenSieverding 

 

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

 

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