Various Ways to Disable/Skip/Comment out Flow Steps when Testing in Power Automate
Sometimes when we are debugging flows, we want some of the steps to be disabled/skipped and ignored by the Power Automate engine so that those actions are not triggered while we are still working on the other parts of the flow. But currently, there is no way in Power Automate to disable the steps for testing/debugging scenarios (yet) even though the Power Automate team has been working on making this feature available
since mid of March last year.
What this post is not about.
This is not about how to
add comments to the flow steps.
What this post is about.
This is about how to disable or exclude the steps in the flow action without deleting the step so that the steps can be re-enabled / re-used later.
(which is equivalent to the programming term “comment out” the code for
switching off a chunk of code temporarily)
Quote from
Wiki:
A common developer practice is to comment out a code snippet, meaning to add comment syntax causing that block of code to become a comment, so that it will not be executed in the final program.
When would you need to use this feature?
I often need this feature when I am testing/debugging the flow and I do not want to trigger some of the steps yet (e.g. there is a "List records" action followed by "Delete a record" step for all records from the
list). In this case, I would want to test the "List records" action first and make sure the output is as I expected and tweak the filter query properly before I let the flow run up to the Delete steps. Otherwise, the flow will delete the records and I would have to re-create the test data again.
Some other times, I want to update the existing flow by removing some of the steps, but I want to keep those steps in an inactive state until I have completely tested the whole flow to be working fine before I completely remove them.
Another scenario is when I need to test the last part of a long running flow and I want to disable the long running process, skip that middle part, mock the data and only test the last part repeatedly.
Here are the different ways you can disable/skip a flow step:
Using the Terminate Action
🛈 Note
If the flow has parallel branches, it is recommended to use the other methods since the Terminate step will terminate the whole flow including the parallel branches.
If the flow has parallel branches, it is recommended to use the other methods since the Terminate step will terminate the whole flow including the parallel branches.
If the steps that you want to disable are at the end of the flow, you can configure your flow so it would not reach the last step by adding the Terminate step with
Succeeded status before it reaches the last steps. That is equivalent to "unreachable code after return statement" in normal programming.
function f() {
var x = 1 + 2;
return;
x = 3 + 4;
}
Using Configure run after
When the steps that you want to skip is in the middle of the flow, you can bundle all of those steps in a Scope control. After that, set the "Configure run after" of the Scope control to "is skipped" or "has timed out" and set the step afterwards as "is skipped" too. You can read more details at this blog post by Pieter Veenstra.
Using Condition control
You can also use the Condition control to skip the steps you don’t want to execute. All you have to do is add a Condition control with dummy condition (e.g. 1 = 1) then move the steps that you do not want to run into the negative branch of the flow and the flow will just skip those steps in every run.
Using Copy to my clipboard
This method is by temporarily deleting the steps from your flow but copying into the clipboard before the step is deleted. This allows you to add the steps back from the clipboard once you are completed with the debugging. However, with this method, there is a risk of losing the steps in the clipboard if the flow designer browser tab crashed or the browser is closed by accident.
If you also have some other tips or other ways that you do to disable/skip some of the flow steps, feel free to comment here or on my social media posts. I would love to know your approach.
to stop at the end of a flow i suggest "configure run after = failed". The terminate step terminates the flow and so other parallel branches also terminate.
ReplyDeleteThat's a great tip. Thanks, Alan. I'll update my post.
DeleteNice to read your article! I am looking forward to sharing your experience.
ReplyDeleteGreat content material and great layout. Your deserves all of the positive feedback it’s been getting.
ReplyDeleteI don't know why i'm here, but i really enjoy this blog post :)
ReplyDelete