Microsoft Flow is an impressive tool that enables us to perform different tasks to solve our business needs. These tasks get executed by responding to several triggers depending on the selected service / connector.
For example, when working with SharePoint lists, we could trigger a Flow on items as they are created or modified. This is great for all kinds of workflows but there is a specific case which could get you into an infinite loop.
If your Flow gets executed by the “When an item is created or modified” trigger and in this same process you update the item, the Flow gets executed over and over again.
Handling the infinite loop
There are several ways to solve this: Melissa Hubbard found a way that implies using a new field for checking. Mikael Svenson uses another approach by dealing directly with the SharePoint API. The third take? using a new Flow account to deal with the updates. By using this approach, we can check if the update came from an actual user or if it was done by our new account.
The first thing is to give this account the proper permissions to perform the updates and then, update our Flow connections to use this account. The last bit, a condition block: was the item created / updated by our account? then do nothing, otherwise, continue with the workflow because this was triggered by an actual user.
After it finishes, the “Modified by” field will be set to our new account so when the Flow gets triggered again the condition block will stop the loop.
I hope this helps you when dealing with SharePoint list triggers.
Remember, never stop learning!
Thanks, simple and perfect! 🙂
Can you please explain the 3rd option in more detail.
How is the account created, would this be set up n our companies global address book?
What permissions should be applied and how?
How does the modified by pick up the Flow account name when the flow triggers the update?