How to use ForEach loop in workflow
Create Application:
Create an application with name “Loop”.

Configure Workflow:
Create a new workflow and assign it the name “TestForEach”

2.Add Schema in the Workflow Context as per the requirement.

Choose Trigger
Select “RestService” as the trigger for the workflow.

Add RestService Path
Set the RestService path to “/testForEach/{num}” or modify according to specific requirements.

In the output of the RestService extend the body with a schema which has an array.

Add UpdateWFVariabale
Incorporate two UpdateWFVariable into the Workflow to update the workflow variable’s as per the requirements.

Grouping of Activity
To group an activity simply select the activity and click on the group icon from the tool grid present in the canvas area.

Group Configuration
Click on the Group Select the Group type to ForEach and fill in the Configuration input fields as per the requirements.

Configure the Activity Inside the group
Configure the UpdateWFVariable Activity inside the group as per the requirements.

Configure End Activity
Configure the End Activity as per the requirements.

Publish the Workflow
Click the publish icon, add comments describing the changes or updates, and then click "Publish" to finalize the process.

Deploy the Workflow
Click on the Deploy icon, then enter a Deployment Name and select the appropriate Environment. Finally, click "Deploy" to initiate the deployment process.

Test the Workflow
Test the workflow by adding the required parameters and headers. Then, click "Send" to initiate the test.

Last updated