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 or agentflow 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. Add the action to the designer canvas and open the action configuration panel. For more information, see Add an action to the workflow.

  2. 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.
  3. Click Add condition to save the new condition.
  4. 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.
  5. 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 or agentflow is triggered by a new file in the selected folder on Box.com. The workflow or agentflow 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 or agentflow then reads the content of the file and performs whatever operation you set up.

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