In this post we’ll discuss how to temporarily prevent MS Power Automate from getting triggered. We will disable it for sometime and then resume the same without much of a hassle.
The reason to suspend a Power Automate can vary depending upon a wide variety of use cases. One such prominent use case is to disable the flow while bulk updating a SharePoint list from a background service/process. While executing a batch request, we may not want to trigger the flow and send unnecessary emails to the stakeholders!
For this post, we’ll be using the SharePoint trigger, When an item is created or modified. It is a Polling trigger. Which means that it will continuously poll our SharePoint list, in a certain time interval. If any change is found then, our flow gets triggered.
Polling flows, when turned on, will process all the pending events. So, by default, if we turn off the flow, do a bulk update and, restart it, the flow will process each item modified during the batch update!
To prevent this behavior, we’ll leverage the use of a special setting, Trigger Conditions.
- Go to the MS Power Automate trigger. Select More Options icon -> Settings.
- Under Trigger Conditions, provide an impossible condition for the flow to run. For ex, is 1 equals to 0?
Since, the condition will always be false, the flow will not run for any of our bulk update changes. Following is its syntax.
- Select the Done button and Save the flow.
- Run our Batch Update.
- Once done, remove the trigger condition from the flow.
- This is a little hack, where we’ll set an impossible condition for the flow to run. Since, the condition will never satisfy, the flow will not be triggered for the items updated during the batch request.
- Once the batch update is completed, we can again remove the Trigger Condition and thereby, enable the flow. It will not start processing the batch request items as they had already been processed. It’s just that the flow was not triggered for any of them.
- We can learn more about the Trigger Conditions, here.
- Also, be sure to remove the impossible Trigger Condition once the batch update is done! 😉