Do a Loop to Repeat an Action

To configure the loop to start the action, do the procedure in this topic.

Figure: General Configuration screen

General Configuration screen
Figure: Loop Configuration screen

Loop Configuration screen

Examples

Prerequisites

Good to Know

  • In most text fields, you can use process data variables as an alternative to literal data values.
  • When you configure a Next Loop activity immediately after a Condition activity, the variables defined in the Initialize Loop activity are populated in the Next Loop activity. If you try to use the variables in any activity between the Condition and the Next Loop, the variables will not have the correct data.
  • You can configure whether this activity waits for other activities before it runs.

    For more information, refer to How Do I Configure an Activity to Wait for Other Incoming Activities?

How to Start

  1. On the App Explorer screen, do one of these:
  2. Do one of these:
    • Add an activity:
      1. In the Process Builder, in the Activity Library, open the Utilities tab.

        Open Utilities tab
      2. On the Utilities tab, drag the Initialize Loop activity onto your process.

        Drag Initialize Loop activity
    • Change an activity:
      1. In your process, double-click your activity.
  3. Click Looping Init Looping Init icon.

Procedure

  1. Complete the fields on the General Configuration screen.

    For more information, refer to Configure General Options for a System Activity.

  2. Click Looping Init Looping Init icon.
  3. On the Loop Configuration screen, complete these fields as necessary.
    Field Name Value

    Source Dataset

    Function:
    Specifies the repeating schema element from the Process Data > Form Data or Model Data tab that stores the list of child elements.
    Accepted Values:
    A valid repeating XML schema element.
    Default Value:
    None
    Accepts Process Data Variables:
    Yes

    Current Row Variable

    Function:
    Specifies a process data variable that stores the values of a column in a data source.
    Accepted Values:
    A process data variable.
    Default Value:
    None
    Accepts Process Data Variables:
    Yes

    Dataset Column Name

    Function:
    Shows the list of child elements from a repeating schema element.
    Accepted Values:
    A valid child element name.
    Default Value:
    None.

    If you specify the repeating schema element in the Source Dataset field, the name of the child element shows.

    Accepts Process Data Variables:
    Yes

    Exit loop when following variable set to true

    Function:
    Specifies a process data variable with a Boolean data type to exit the loop. When the variable is set to true, the loop completes, and the process moves forward.
    Accepted Values:
    A process data variable.
    Default Value:
    None
    Accepts Process Data Variables:
    Yes
  4. To complete the configuration, click OK.
  5. On the Common tab, drag the Condition Condition icon activity onto your process immediately after the Initialize Loop activity.
  6. Configure the Condition activity to check if the loop exit variable in the Exit loop when following variable set to true field is set to true.
  7. On the Utilities tab, drag a Next Loop Next Loop icon activity onto your process immediately after your Condition activity.
  8. On the General Configuration screen for the Next Loop activity, in the Loop Initiate Activity Name field, select the name of your Initialize Loop activity.