How to stop infinite loop in Power Automate using Multiple lines of text
We have previously discussed how to stop infinite flow using CSOM update, flag column with form and modified by column, By the way, in this method we can do from the workflow itself even if we don’t have a customized form and it will be much easier than the uglier CSOM HTTP request.
First we will create a multiple lines of text column and set “Yes” to Append changes to existing text option.
Select Advanced settings and Set “Yes” to Allow Management of content types
It will enable the “Item” content type in the list settings, Select the “MultiLineFlag” column and set it to Hidden.
Change the Allow management of content type to No again.
Append change to existing text will automatically create a version history on that list, whenever a change is made to the item if the “MultiLineFlag” column is not updated it will update as an empty value.
We can use the Update Item action and update the “MultiLineFlag” to some value.
Open the Menu of trigger action and add trigger condition
We are triggering the flow when the “MultiLineFlag” has no value otherwise it will not trigger.
When the item is updated from the form since the “MultiLineFlag” is hidden it will be updated as an empty value and the flow will trigger and in the workflow, we are updating the “MultiLineFlag” to some value so the workflow will not trigger.
@equals(triggerOutputs()?['body/MultiLineFlag'],null)
Let’s test with a record, we are updating the item, the MultiLineFlag is updated as empty as shown below and the flow is triggered.
The flow will update the “MultiLineFlag” as “Workflow Update” so the workflow will not trigger.
In some cases we are not allowed to create new columns in our environment at that time we have to rely on CSOM update otherwise this method will be the simpler way to handle the infinite loop.
Please post your queries in the comment section. Happy Building 🙂
Very interesting way to avoid loops, but I have a problem when creating flow to a document library approval.
The option of “append Changes to existing text” doesn’t appear in the library when creating column, so I created the column in site and then I’ve imported to Library.
But following step by step instruction (hidden column…) I have a problem. It works perfectly when uploading a new file, but not working when “overwrite” an existing file. I’ve seen that Column “MultiLineFlag” is not updating to null, it’s still on “workflow update”, so flow doesn’t trigger. Any idea how to solve this?
Regards!!
Hi Garcia, Try using CSOM update it will not trigger the workflow instance.
CSOM Update
Hello, a great article!
A question: this method applies to SharePoint lists,
however I am trying to adapt the same tactic on SharePoint doc libraries.
But I am unsuccessful because the multiline text box does not have the “Append Changes to Existing Text” it is not a selectable option. Therefore, how would you suggest to tackle the libraries?
If I implement your guide, the result is that the cell remains with text and this prevent ANY new human edit to trigger the flow.
Hi Francesco, This approach is suitable for libraries, as Jesus Garcia mentioned it is not working on the update scenarios for document libraries.
Consider trying the CSOM approach.
CSOM Update
This is a great work around. Worked for me 100%. Thank you
Thanks Ralfalpert, Happy Building