Understand Cancel Flow Run Action In Power Automate

Introduction

Generally, in certain scenarios, we must cancel current flow if at all some condition was not met. So, without opening each flow in the consolidated list of flow runs we can easily find which flow runs passed and which are canceled. In Power automate we can achieve this by using Cancel Flow Run Action.

Step 1

Login to the required Power Apps environment using URL make.powerapps.com by providing username and password and click on Flows on the left-hand side as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate

Step 2

After Step 1, Click on New Flow and select instant cloud flow and provide the trigger as Manually trigger a flow and click on Create as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate

Step 3

After Step 2, name the flow as Understand Cancel Flow Run Action and Manually trigger provide input values by selecting type of user input as text as

Title : Signal
 Value : On 

as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate

Step 4

After Step 3, Take Initialize variable action and provide the values as below

Name : Signal Status
Type : String
Value : @{triggerBody()['text']} [ From Step 3]

as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate

Step 5

After Step 4, take condition Action and provide the values

Left side as variables(‘Signal Status’)
Comparison operator: is equal to
Value : on

Understand Cancel Flow Run Action in Power Automate Figure 5

Step 6

After Step 5, under yes part take a compose action and provide the inputs

As

Inputs : Good Wifi Network connectivity

as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate Figure 6

Step 7

After Step 6, under no part of the flow take a cancel Flow Run action and establish the connection as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate Figure 7

Step 8

After Step 7, we must provide the values as below

Environment : workflow().tags.environmentName
Flow :workflow().name
Run ID : workflow().run.name

As shown in the below figure

Understand Cancel Flow Run Action in Power Automate Figure 8

Step 9

After Step 8, now save and test the flow and provide the value as on you should see the see the yes part of the condition action will get executed as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate

Step 10

After Step 9, now save and test the flow and provide the value as off you should see the see the no part of the condition action will get executed and cancels the flow run as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate

Step 11

After Step 10, now see the flow runs and observe Status as Test succeeded / Test canceled as shown in the below figure.

Understand Cancel Flow Run Action in Power Automate

Note

  1. Based upon the use case this cancel flow run action can be used.
  2. Not only we can cancel current flow but also, we can stop any child flows in case if some condition was not met.

Conclusion

In this way, we can easily use Cancel Flow Run Action in power automate.


Similar Articles