Flow Control in Logic Apps
There are various ways to control the flow in a workflow definition of a Logic App. In the designer, you can add an action and choose control. With the control action, you can choose between a Condition, For each, Scope, Switch, Terminate and Until as shown in the screenshot below.
For each and Until are looping option you can have in a Logic App, and both are detailed in the ‘Looping options in Logic Apps’ tip. Moreover, the Scope action to control flow is discussed in the tip ‘Group Actions Logically Using Scopes’, which leaves us with three other flow control options: Terminate, Switch, and Condition.
With Terminate action, you can end a workflow instantly with status Succeeded or Cancelled or Failed – where you can include code and message. A typical pattern could be to include error handling within your Logic App, and within the exception handling, you terminate the flow.
Switch, and Condition are actions you use to allow your flows to go through an alternate path. For instance, Switch action is similar to the switch statement in C#. You specify a switch action in a Logic App and based on the result of the value of an object, a series of actions is executed.
The Condition action is a flow control allowing you evaluate the value of an object and in case it’s true to do a series of actions - and in case it’s false to do another set of actions – similar to if statement in C#.
To conclude, Control actions in Logic Apps allow you to control the flow in a Logic App and provide a way to address complexity in your flows.