Control Flow Activities
Control Flow Module
The Control Flow activities module provides activities for controlling flow of execution within your project.

Note that while activities such as the Parallel and Sequence schedule multiple child activities for execution simultaneously, only a single thread is used for a workflow. Each child activity of these activities executes sequentially and successive activities do not execute until previous activities either complete or go idle. As a result, these activities are most useful for applications in which several potentially blocking activities must execute in an interleaved fashion. If none of the child activities of these activities go idle, a Parallel activity executes just like a Sequence activity.
Activities
Start
Optional. Marks the starting point of the workflow. If no Start activity is used, the workflow starts at the activity that has no incoming connection.
FlowDecision
Evaluates a condition and continues along its Yes or No path.
If
Evaluates a condition and executes the activity connected to Then if it is true, or the activity connected to Else if it is false.
Switch
Executes the case whose name matches the value of an expression (e.g. a data field, variable or parameter), or the Default case.
While
Repeats a list of activities as long as a condition is true.
Sequence
Executes its child activities in order, one at a time.
Parallel
Executes its branches at the same time, then continues when all of them have finished.
Redirect
Jumps to a specific activity in the workflow, optionally choosing the target with conditions.
OnDemand
Container that holds activities which are not part of the main flow. They are easy to find at design time and, at run time, each one runs only when it is called.
EndWorkflow
Ends the running workflow instance. See EndWorkflow in the Base module.
FlowDecision, If and While require a condition; the workflow does not validate until one is defined. Switch requires its switch expression.
How the containers execute
FlowDecision runs any actions defined on it, evaluates its condition, and follows the Yes connection if it is true or the No connection if it is false.
If executes a single activity on each branch: the first activity connected to Then or to Else. To run several activities on a branch, connect a Sequence and place them inside it.
Switch compares the value of its expression with the name of each case. The comparison is exact and case-sensitive (Paris does not match paris). If no case matches, the Default case runs. Each case can contain a chain of activities.
While checks its condition before every iteration, so its activities may run zero times. The loop stops when the condition becomes false, or when the workflow is ended, cancelled or exceeds its maximum run time.
Sequence runs its activities in order. When a Sequence has several sequence outputs (seq1, seq2, …), they run one after the other, in that order.
Parallel starts each branch on its own thread and waits for all of them to finish before continuing through its Exit connection. Each branch executes the single activity connected to it; to run several activities on a branch, connect a Sequence and place them inside it.
Caution: Parallel branches run at the same time and share the workflow's values. Do not let two branches write the same variable, data field, Source or Target, and avoid dialog activities inside a Parallel.
Restrictions and best practices
How threads run
Each connection from a Parallel thread output starts a thread. All activities connected in sequence on that thread run in order.
All threads run at the same time. The activities connected to the Parallel's Exit output run only after every thread has finished.
If an activity in one thread fails with an error, the other threads finish their current work, and the workflow then ends. The error log lists every thread that failed.
A Parallel activity with no threads connected does nothing, and the workflow continues to the Exit output.
Parallel activities can be placed inside other Parallel threads.
Every container also respects its own condition and execution plan: when they say the activity should be skipped, its children do not run and the workflow continues.
Activity properties
Start
Delay
Optional delay before the workflow starts, as a TimeSpan (default 00:00:00:00, no delay).
RedirectionSettings
Optional. Redirects the start of the workflow to another activity (see Redirection settings).
Only one Start activity is allowed per workflow.
Redirect
Delay
Optional delay before redirecting, as a TimeSpan (default 00:00:00:00, no delay).
RedirectionSettings
The redirection rules (see Redirection settings). At least one is required.
Redirection settings
Start and Redirect share the same redirection settings. Each item has:
RedirectionCondition
The condition to evaluate.
IfConditionTrueRedirectTo
The activity to go to when the condition is true.
IfConditionFalseRedirectTo
The activity to go to when the condition is false.
Items are evaluated in order. The first item that yields a target activity decides where execution goes; the remaining items are ignored. If no item yields a target, the workflow continues along the activity's outgoing connection. Any delay and optional pre-execution actions run before the redirection takes place.
The target is found by its display name and must be at the same level as the Start or Redirect activity. You cannot redirect into, or out of, a container such as a Sequence or While.
Last updated