Nov 18 2022 02:19 PM - edited Nov 18 2022 02:25 PM
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
Nov 19 2022 02:36 AM
Solution@Acorn999
i use
@not(equals(triggerOutputs()?['body/Editor/Email'],'<email of the serviceaccount>'))
Nov 19 2022 02:37 AM
Nov 19 2022 04:43 AM
Nov 21 2022 11:00 AM
@not(equals(triggerOutputs()?['body/Editor/Email'],'<email of the serviceaccount>'))
This code from you is successful. Solves my issue. Very appreciated!
May 19 2023 02:19 PM
Nov 19 2022 02:36 AM
Solution@Acorn999
i use
@not(equals(triggerOutputs()?['body/Editor/Email'],'<email of the serviceaccount>'))