Skip to main content

How to Stop a Flow Run with Terminate in Power Automate

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

Terminate ends a flow run at that point, and you choose how it's recorded: Succeeded, Failed or Cancelled. Put it in a branch of a condition, and the flow stops when that branch runs, without running the rest.

The Azure Logic Apps workflow actions reference, which covers Power Automate's built-in actions too, says: This action stops the run for a workflow instance, cancels any actions in progress, skips any remaining actions, and returns the specified status. The statuses: "Failed", "Cancelled", or "Succeeded".

The example is the approval flow of the Overtime Timesheet app. When an entry changes while its approval waits, the old approval mustn't decide the new version, so the flow stops.

Prerequisites​

Step 1: Add Terminate to the Branch​

In the condition's False branch, add an action, search for Terminate, and choose it under Control. I named it Stop: the entry changed, so the run view says why it stopped.

Step 2: Choose the Status​

StatusUse it when
SucceededStopping is a normal, finished outcome
FailedSomething went wrong that someone should look at
CancelledThe run's work no longer applies

Here, the approval was for a version of the entry that no longer exists, so Cancelled:

The Stop: the entry changed pane on its Parameters tab with Status set to Cancelled

The reference adds that it can't appear inside Foreach and Until loops; inside a condition is fine.

The Result​

Maya Patel changed her entry while its approval waited, and Daniel Brooks then approved the old request. The run went down the False branch: Stop: the entry changed succeeded, and the three actions in the True branch, which would have recorded the decision, were skipped:

The run view: Ask for approval succeeded after 3m 8s, Get the entry now succeeded, Check the entry is unchanged marked Terminated; under True, Record the decision, Set the approval status and Tell the employee skipped; under False, Stop: the entry changed succeeded

The run view's banner said:

A banner reading Your flow run has been canceled.

And the run history listed it as Canceled, spelled with one l there, among the succeeded runs:

The 28-day run history: 05:08 PM Succeeded, 05:06 PM Canceled, and three earlier runs Succeeded

Common Mistakes​

MistakeWhat happensDo this instead
Failed for an expected stopNormal runs look like errorsCancelled or Succeeded
Terminate inside Apply to eachIt isn't allowed in loopsStop after the loop, or use a condition outside it
Leaving the name TerminateThe run view doesn't say why it stoppedName it after the reason

Troubleshooting​

SymptomLikely causeFix
The run carried on after the conditionTerminate is in the other branchMove it to the branch that should stop
The run shows as failedThe status is FailedChoose Cancelled
Actions after the condition ran tooThey're outside the branchTerminate stops everything after it

FAQ​

Does Terminate undo what already ran?​

No. The reference says it doesn't affect already completed actions. Put it before anything that shouldn't happen.

Why is the condition marked Terminated?​

The run view marks the condition that contains the Terminate action as Terminated; the action itself succeeded.

Conclusion​

Terminate ends a run where it stands and records it as Succeeded, Failed or Cancelled. In a condition's branch, it stops a flow whose work no longer applies, and the run history says so.

Additional Resources​