Add a loop

You can loop through the items within a list in a data object using the Loop node in your workflow.

Add a Loop node to your workflow and select a list within a data object variable. You can either map individual fields (supported within Quick Apps) or use object level mapping to return all data for the instance found without the need to map all the individual return fields. Then, create a task for each item found and not found.

The following elements are added along with the Loop node:

  • Index and row found variables are auto-created and mapped.

  • Decision for the row found is added with True path and False path.

  • True path is linked to the task when an item is found and then looped back to the Loop node.

  • False path is linked to the task when there are no more items.

  1. Click below the Start node or any other node.

    The Add activity dialog box is displayed.

  2. On the Type list, select Loop. (Default:Task)
  3. By default, the Title is displayed as activity type. You can change the title as needed.
  4. On the Data object list, select a data object variable from an existing list.

    Alternatively, create a new variable if the required variable is not available. Click and in the New dialog box, create the variable as needed. See Create variables.

    When creating the variables, use the Loop as title and the variable name, such as, LoopIndex and LoopRowFound.

  5. Select either option for Return to map either the list field as a whole or its columns.
    • Field(s) (default): The list of fields from the selected data object are displayed in the table. Map the fields to the corresponding variables to return the data for the mapped fields.

    • Object: Map the data object variable to return all data for the instance found.

    If the required variable is not available, you can create a new variable using .

  6. To set the true path to a task when an item is found, in the Item found go to perform the following steps:
    1. On the Type list, select Task.
    2. In the Name field, a default name for the activity appears. You can modify the name as needed.
    3. Optional. Enter a Description for the node, such as "When cost is > 500".
  7. To set the false path to a task when no more items are found, in the Go to when no more items found perform the following steps:
    1. On the Type list, select Task.
    2. In the Name field, a default name for the activity appears. You can modify the name as needed.
    3. Optional. Enter a Description for the node, such as "When cost is < 500".
  8. Click Add.

    When you remove a Loop node, the system removes any unused variables within the node.