Description:
The For Loop workflow step provides a controlled way to repeat a section of a workflow for a configured number of iterations.
The step accepts the number of times the loop should execute and the name of the Variable or Global variable associated with the loop. It provides separate loop and loopCompleted return paths so the workflow can distinguish the repeating portion from the path that continues after the loop completes.
The step supports:
- Configuring the number of loop executions.
- Storing the loop value using a Variable or Global variable.
- Repeating a series of workflow activities.
- Connecting the repeating workflow path through the loop return.
- Continuing workflow processing through the loopCompleted return.
- Using the loop as part of batch, repeated, or iteration-based workflow processing.
Inputs
- loopCounter - The loopCounter property specifies the number of times the loop should execute.
- Name of the Variable/Global - The variableName property specifies the name of the Variable or Global variable associated with the loop.
Returns
- loop – The loop return path is used for the repeating portion of the workflow.
- loopCompleted - The loopCompleted return path is used when the configured loop processing has completed, and the workflow should continue beyond the loop.
Usage:
Place the For Loop step before a group of workflow activities that need to run repeatedly.
The workflow specifies the number of executions through the # of times the loop should execute and provides the name of a Variable or Global through the Name of the Variable/Global.
A typical workflow pattern is:
For Loop → Perform Repeated Work → For Loop → Continue After Completion
For example:
Start
↓
For Loop
↓
Process Item
↓
Update Result
↓
For Loop
↓
loopCompleted
↓
Continue ProcessThe repeating activities can be used to:
- Process a collection of items.
- Perform a task a fixed number of times.
- Generate repeated records.
- Execute repeated calculations.
- Create multiple documents or outputs.
- Perform repeated notifications.
- Invoke another workflow activity repeatedly.
- Build batch-processing workflows.
- Continue with subsequent processing after all iterations have completed.
The distinction between the loop and loopCompleted paths matters when designing the workflow because repeated activities belong in the loop, while processing that should occur only after the repetitions are complete should connect to loopCompleted.

Typical Workflow Suggestions:
Process a Fixed Number of Items
Use the For Loop step when a workflow needs to perform the same operation a known number of times.
Example:
For Loop → Process Item → Repeat → loopCompleted → Continue
For example, if a workflow needs to process five items, configure the loop count accordingly and place the item-processing activities on the repeating path.
Generate Multiple Documents
Use a loop when a workflow needs to create or process multiple documents using the same sequence of activities.
Example:
For Loop → Prepare Document → Create Document → Repeat → loopCompleted → Continue
Each iteration can perform the same document-processing sequence.
This can be useful for batch document generation where the workflow knows the required number of iterations.
Send Repeated Notifications
Use a loop when a workflow needs to run the same notification-related activities multiple times.
Example:
For Loop → Prepare Notification → Send Notification → Repeat → loopCompleted
The repeated portion can prepare and send the notification for each iteration.
Perform Repeated Calculations
Use the step to perform a calculation or transformation repeatedly.
Example:
For Loop → Calculate Value → Store Result → Repeat → loopCompleted → Continue
This can be useful when a workflow needs to perform the same calculation a specified number of times.
Process a Batch
Use the For Loop step as the control mechanism for a batch-processing workflow.
Example:
Start → For Loop → Get/Process Item → Save Result → Repeat → loopCompleted → Complete
The repeated activities can represent one unit of batch processing.
Create Multiple Workflow Outputs
A workflow can use the loop to produce multiple outputs using the same processing sequence.
Example:
For Loop → Prepare Output → Generate Output → Repeat → loopCompleted → Continue
The loop count determines how many times the output-generation sequence is executed.
Execute a Repeated Integration Operation
Use a loop when you need to perform the same integration operation repeatedly.
Example:
For Loop → Prepare Request → Execute Integration → Process Response → Repeat → loopCompleted
This provides a workflow structure for repeated integration processing.
Handle the exact behavior of any external integration in the activities inside the loop, rather than assuming the For Loop step provides it.
Perform Repeated Data Processing
Use the loop to execute a common data-processing sequence multiple times.
Example:
For Loop → Retrieve Data → Process Data → Store Result → Repeat → loopCompleted
This pattern is useful when the workflow needs to run a fixed number of processing cycles.
Build a Repeating Approval or Review Sequence
A workflow can use the loop to repeat a sequence of activities when the business process requires multiple rounds of processing.
Example:
For Loop → Review → Process Review Result → Repeat → loopCompleted → Continue
The loop provides the repetition mechanism, while the activities inside the loop perform the actual review processing.
Perform Repeated User or Administrative Processing
Use a loop to repeat the same workflow sequence when you need to process a fixed number of users or administrative operations.
Example:
For Loop → Identify User → Perform Operation → Record Result → Repeat → loopCompleted
Replace the activities inside the loop with the appropriate user-management operation.
Use a Variable or Global for Loop Processing
The step explicitly requires the name of a Variable or Global variable.
Example:
For Loop → Process Item → Update Variable → Repeat → loopCompleted
This makes the loop-related value available to other workflow activities, depending on the behavior supported by the FlowWright implementation.
The XML identifies the property as Name of the Variable/Global, rather than defining it as a dedicated numeric counter data type.
Separate Repeating Work from Post-Loop Processing
Use the two return paths to clarify the workflow structure.
Example:
┌── Process Item ──┐
│ │
Start → For Loop ────────────────┘
│
└── loopCompleted → Final Processing
Example:
Let’s build and execute the “loopDef” example.
- Create a new process definition called “loopDef” and open the definition in designer mode.
- Drag the “Loop, EvalExpression, UpdateVariable” steps to the canvas.
- Connect the dots between the “Start” and other steps, as shown above. Configure the connection lines between the Loop, EvalExpression, and UpdateVariable steps, as shown above.
- Select the line between the steps to configure the “Connection Properties”. The default property values are “None, Loop, LoopCompleted, Error, and Evaluate”. Depending on the step’s purpose, you can configure additional values.
- Define a variable or a global to store values.
- Click the “Loop” step to configure its “Required” properties. Name the step, set the loop value, and create a variable or global to store the result. Then click the Save button. Note: Click the "AI Predict" button to have the Copilot add new process steps that match your process description.

- Click the “UpdateVariable” step to configure its “Optional” properties. Enter a step name. Click the “Advanced” tab. Enter the variable reference and value. Select “No” for the “Has Expression” field if the variable value is not a C# expression. Click the Save button.

- Click the “Evaluate Expression” step to configure its “Required” properties. Specify a variable or global to store the expression result. Enter the expression syntax to evaluate. Click the Save button. Note: Click the "AI Predict" button to have Copilot add new process steps that match your process description.

- The “Logging” configuration is necessary for documentation and also measures workflow progress and percent complete. Configure the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.

- Save the process definition, create a new instance, and execute it. Render the process instance and click the For Loop step to view its properties. When the workflow reaches the For Loop step, FlowWright uses the configured loop count and Variable/Global information to run the loop. The workflow follows the loop path for the repeating portion and the loopCompleted path when the loop finishes. Verify that:
- The loop count is configured correctly.
- The required Variable/Global name is valid.
- The activities intended to repeat are connected to the loop path.
- Post-loop activities are connected to loopCompleted.
- The workflow performs the expected number of iterations.
- Activities that should execute only once after the loop are outside the repeating path.

Tips:
- Provide a valid value for # of times the loop should execute.
- Make sure the configured loop count matches the intended number of repetitions.
- Provide the required Name of the Variable/Global value before executing the step.
- Use a meaningful Variable/Global name so other workflow designers can understand the loop's purpose.
- Keep the activities belonging to the repeated operation clearly grouped on the loop path.
- Connect activities that should execute after all iterations to loopCompleted.
- Avoid placing activities that should run only once inside the repeating portion of the workflow.
- Test the workflow with a small loop count before using a larger production value.
- Verify workflow execution to ensure the repeated activities run the expected number of times.
- Consider logging the purpose of a complex loop so that its execution is easier to understand when reviewing a workflow instance.
- When a loop processes data, ensure the activities inside the loop correctly identify or prepare the item for the current iteration.
- When using Variables or Globals with the loop, use consistent naming conventions.
- Keep the repeated workflow sequence as focused as possible. Unrelated activities can make loop behavior harder to understand and troubleshoot.
- Test the loopCompleted path separately to ensure that post-loop processing occurs only after the intended repetitions have finished.
- Be careful when connecting the end of the repeated sequence back into the loop structure. An incorrect connection can result in workflow behavior that does not match the intended design.
- The XML defines both the loop count and Variable/Global name as string properties. Do not assume that the step exposes a separate integer or counter data type.
- Do not assume additional loop behavior such as zero-count handling, negative-count handling, dynamic counter semantics, or exact Variable/Global update behavior unless confirmed by the FlowWright implementation.
- Do not assume that the names loop and loopCompleted provide more runtime semantics than are documented. The XML establishes these as the two return values, but does not document their internal execution rules.
Notes:
- The For Loop step is defined in the Engine category with the internal name
loopLabel “Performs a series of steps N number of times”, and display name “For Loop.” - The step is implemented by
FlowWright.Workflow.LoopStepinFlowWright.Workflow.dlland is defined as a Process step with 2 incoming connections and 2 outgoing connections. - The step defines two required properties:
-
loopCounter– # of times the loop executes -
variableName– Name of the Variable/Global
-
- Both properties use the string data type, implemented by
FlowWright.DataTypes.ClsTextBox. - The step provides two return values:
- loop
- loopCompleted
Definition Sample:
You may download the sample definition from the link provided and later import it into your FlowWright Process Definition (XML file) or Form Definition (HTML file) page.
Note: Verify and complete any missing configuration after importing the sample, including:
- Loop count.
- Variable or Global variable name.
- Workflow Variable references.
- Activities belonging to the repeating loop.
- The loop connection.
- The loopCompleted connection.
- Environment-specific settings.
- Logging configuration.
After verifying the configuration, save the Process Definition before execution.
Click here to download the sample file.
You can also loop the workflow by routing the connection lines back to the previous step. Configure the connection line status to prevent an endless loop, as shown below.
