Using Loops

Derick Larson
Workflow Developers


Loops are used when you need to repeat a set of the same nodes a specific number of times.

NOTE - task loops do not have the concept of a for loop or do while loop. For that type of functionality consider using a recursive routine. Instead, iterations of a loop happen, essentially, all at once.

Loops are comprised of two different nodes, Loop Head and Loop Tail

Loop Head

The Loop Head node controls how many times the loop is processed and what data is used with the XML and XSL parameters. The Loop Head is also referred to as Loop Begin in some documentation.

Example Loop Head node. loop head parameters

Set the XML document in the Data Source parameter, and the XSL in the Loop Path parameter.

Variable Name this optional parameter was used to identify a variable from the xml to be used in each loop iteration. It's common now to use the output of the loop head node (<%=@results['Loop Head']['value']%>) from the parameter list.


XML (Data Source)

  <id>han solo</id>
  <id>darth vader</id>
  <id>leia organa</id>

XSL (Loop Path)


In this example the loop would process three times passing the value, han solo, darth vader, and then leia organa.

Loop Tail

The Loop Tail controls where the end of the loop is, and when the loop is exited. The Loop tail is also referred to as Loop End in some documentation.

Settings in the Loop Tail are the same as a Join node. loop tail details Type selection determines when the Loop Tail node completes and progresses farther through the tree.

  • All is every loop instance processes completely through to the Loop Tail
  • Any is the first instance that completes the loop. No other instance will move forward.
  • Some requires you to determine how many loop instances must complete before the Loop Tail completes.


Connecting nodes in a loop is similar to normal connecting. Inside the loop (between the Loop Head and Loop Tail) nodes connect normally. The difference for a loop, is that you must also connect the Loop Head directly to the Loop Tail node. This connection tells the engine what nodes are between the Loop Head and Loop Tail and are then included in an individual loop instance.


Below is a very simple loop modeled after a batch update to person records. simple loop with connections In this loop you can see that the Loop Head is connected directly to the Loop Tail, along with the two nodes that are part of the update process.

Run Example

Example run using the hard coded values from above. example loop run The important thing to notice on this run is that after the tasks for the initial Loop Head and Loop Tail (lines three and four), there are individual Loop head Tasks and Triggers for each instance the loop is run. The tasks are differentiated by the index number of their execution (for example, the first is [0]).

The details for one of the Echo nodes is shown to see its output. The parameter for the Echo node is <%=@results['Loop Head']['value']%>