Start a loop

Use loop actions A tool for building the processes, logic, and direction within workflows. Actions are the steps the workflow performs to complete a process. to repeatedly run a set of child actions. The Start a loop action runs its child actions while a condition is true. When the condition is no longer true, the workflow proceeds to the next action after the Loop for each container.

The Start a loop action runs child actions while a condition is true. For example, you can use this action to continually reformat a redirect URL until the status code returned by the web service call no longer indicates a redirect.

Before you begin: 

  • Understand Variables

  • Understand container actions. You can add actions to create branches such as Branch by stage or to contain other actions such as Action Set that can be collapsed down into a single action high-level view.

Jump to:

Configure the Start a loop action

In the Designer page:

  1. Click the Logic and flow action group in the action toolbox.

    or

    Find actions by browsing action groups, or by typing an action name or function in the Search field at the top of the action toolbox.

  2. Drag the Start a loop action to where you want to run a set of actions while a condition is true.

  3. Click the Start a loop action.

  4. Complete the condition fields: 

    Note: The maximum number of iterations in a loop is 1000.

    1. For When, select the variable you want to evaluate.

    2. For Operator, select an operator for comparing the variable to the value.

    3. For Value, specify a value for the comparison. You can insert a variable or type the value.
  5. Click Add condition to save the new condition.
  6. For each additional condition you want to add: 
    1. Click Add condition.
    2. Fill in the condition fields: 

      1. For When, select the variable you want to evaluate.

      2. For Operator, select an operator for comparing the variable to the value.

      3. For Value, specify a value for the comparison. You can insert a variable or type the value.
    3. Click Add condition to save the new condition.
  7. Select any or all to determine how to evaluate the set of conditions.

For more information on the fields, see Start a loop fields, buttons, and settings.

Example: Continually reformat URL while 300 or 301 status code is returned

In this scenario, your workflow is triggered by a new file in the selected folder on Box.com. The workflow attempts to download the new file through a link. Because Box download links are redirect URLs, the workflow will extract the redirect portion of the URL and retry the URL until download is successful. The workflow then reads the content of the file and performs whatever operation you set up.

Workflow design involves configuring the new file trigger, adding workflow variables, creating a download link, and then modifying the URL as needed and attempting download. After this part of the workflow, you can set up other operations on the content of the downloaded file, such as parsing comma-separated values.