How to terminate workflow - KB

How to exit from entire workflow based on some conditions

Step By Step Guide

Conditional Approach to Workflow can be achieved in multiple ways . 

IF ACTIVITY: 
Below workflow includes a "IF" activity.

 

  1. Then include a Sequence with WriteLine Activity displaying "I am true Part"
  2. Else include a Sequence with WriteLine Activity displaying "I am false Part"

 


Similarly, we can implement separate workflow if the number of activities is too high, and call it using Invoke Workflow Activity. 
For more details refer the link here


 


FLOW DECISION ACTIVITY: 
In a similar approach we can implement 2 separate sequence.  
"Flow Decision" in the Activities panel to achieve a condition. 
An activity which executes one of two branches, depending on whether a specified condition is met. The branches are entitled True and False by default, but their names can be changed in the Properties panel. This activity can only be used in a Flowchart and is equivalent to the If activity.
For more details please click here

 
Flow Switch Activity: 
A Flowchart specific activity that splits the control flow into three or more branches, out of which one is executed based on a specified condition. 
All the possible sequences out of which one is executed, based on its match with the provided Expression. 
For more details refer click here

 

 

Terminate Workflow & Throw activity:

 

Force a workflow to end you can use Terminate Workflow activity or Throw activity to throw an exception but this approach will terminate the workflow with an exception. 

In the workflow examples the workflow terminates immediately after displaying counter value 30.