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.
Step 2
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.
Step 3
The flow as Understand Cancel Flow Run Action and Manually trigger provide input values by selecting type of user input as text.
Step 4
Take Initialize variable action and provide the values as below
Step 5
Take condition Action and provide the values
Step 6
Under yes part take a compose action and provide the inputs
Step 7
Under no part of the flow take a cancel Flow Run action and establish the connection as shown in the below figure.
Step 8
We must provide the values as below In the enter Value and give formula in the expression
Environment : workflow().tags.environmentName
Flow :workflow().name
Run ID : workflow().run.name
Step 9
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.
Step 10
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.
Step 11
The flow runs and observe Status as Test succeeded / Test canceled as shown in the below figure.
Note
Based upon the use case this cancel flow run action can be used.
Not only we can cancel current flow but also, we can stop any child flows in case if some condition was not met.