Use control flow activities to provide structure—branches, loops, or timer delays—for your workflow. The current release of Authoring Tool provides four built-in control flow activities:
- Delay Activity.
Introduces a delay between activities in a workflow.
- For Each Loop
Activity. Takes as an input an array (collection) of
objects and repeats the set of activities in the For Each
Loop object in the collection.
- IfElse Activity.
Controls the sequence of activities in a workflow based on a
Boolean (True/False) condition.
Activity. Forks the sequence of activities into two
simultaneous sequences of activities.
To use a Delay activity, just drag the Delay activity into the workflow, and then set the activity’s TimeoutDuration property to the delay interval you want to use. To use an IfElse or Parallel activity, drag the activity into the workflow, and then drop regular activities into the IfElse or Parallel activity.
Using a For Each Loop activity resembles using an IfElse or Parallel activity; however, you might want to set additional properties for the activities in the For Each Loop. Use the following procedure to add a For Each Loop to a workflow.
To add a For Each Loop to a workflow
In the Management Pack Explorer, expand Workflows, right-click the workflow you want, and then click Edit. This opens the workflow in the authoring pane.
In the Activities Toolbox pane, locate the activity group Control Flow.
Drag the For Each Loop activity to a position between the Workflow Start and Workflow End icons, or between two existing activities.
Add the activities which you want to loop the execution to the Loop Container(ForEachChildActivity). To add each activity:
- In the Activities Toolbox pane, expand the activity
group that contains the activity that you want to use.
- Drag the activity to a position to the top of the Loop
Container activity. If the Loop Container activity
already contains other activities, drag the new activity to a
position before, after, or between the existing activities.
- Most workflow activities that you place in this container have
two additional properties: Current Item and Property to
Bind. For each activity within the loop container, set these
properties as follows:
Setting the properties is not mandatory and is useful only if you want to take the object from the Input Collection of the Loop Container.
- Set Current Item to the Current Item property of
the Loop Container activity of the ForEach activity.
Note that if this activity is the first activity in the For Each
Loop, Current Item is set automatically.
- Set the value of the Property to Bind property to the
value of the property of the current activity that will use the
Current Item value.
- Set Current Item to the Current Item property of the Loop Container activity of the ForEach activity. Note that if this activity is the first activity in the For Each Loop, Current Item is set automatically.
- In the Activities Toolbox pane, expand the activity group that contains the activity that you want to use.