Flow.Documentation
ProfessionalWorkflows

Loop: repeat while a condition holds

6 steps± 4 minVideoVerified 22 Oct 2026
  1. Step 1 · Open Flow and create a workflow
  2. Step 2 · Start at page 1
  3. Step 3 · A loop with a condition
  4. Step 4 · Move the counter on
  5. Step 5 · Put the steps in one line and save
  6. Step 6 · Run

Sometimes you do not know beforehand how often something must happen: an API that answers page by page, an attempt you repeat until it works. Then you set the Loop to While a condition holds. The condition is checked before every pass; a step inside the loop must eventually make it false.

Watch the whole guide as a video6 steps in one film
Step 1 / 6

Open Flow and create a workflow

In the portal, under Environments, click Development and there Open; Flow opens in a new tab. There, click + next to General, choose New workflow and give it a name. A new workflow starts with an Event trigger: the point where it begins.

  1. Click Development
Open Flow and create a workflow · Click Development
  1. Click Open ↗
Open Flow and create a workflow · Click Open ↗
  1. Click Add to General
Open Flow and create a workflow · Click Add to General
  1. Click New workflow
Open Flow and create a workflow · Click New workflow
  1. In Workflow name, type Guide · page by page
Open Flow and create a workflow · In Workflow name, type Guide · page by page
Step 2 / 6

Start at page 1

Put under the trigger's Sample data (Code) which page you start at. In this example there are three pages.

  1. Click the step ‘Event trigger’
Start at page 1 · Click the step ‘Event trigger’
  1. Click Code
Start at page 1 · Click Code
  1. In the sample data, type `{
Start at page 1 · In the sample data, type `{; ;
Step 3 / 6

A loop with a condition

Add a Loop and choose While a condition holds under Repeat. Write the condition: page is less than or equal to 3. Under Maximum number of items is a safety limit: if the condition stays true by mistake, the loop stops there with a message.

  1. Click Add node
A loop with a condition · Click Add node
  1. Click Loop
A loop with a condition · Click Loop
  1. In Name, type While there are pages
A loop with a condition · In Name, type While there are pages
  1. Click While a condition holds
A loop with a condition · Click While a condition holds
  1. In Which field to check?, type page
  2. In Comparison, choose is less than or equal to
  3. In Value, type 3
A loop with a condition · In Which field to check?, type page; In Comparison, choose is less than or equal to; In Value, type 3
  1. Click the dot of ‘Event trigger’
A loop with a condition · Click the dot of ‘Event trigger’
  1. Click the dot of ‘While there are pages’
A loop with a condition · Click the dot of ‘While there are pages’
Step 4 / 6

Move the counter on

At the bottom of the loop, choose Transform data under Add step and set page to = page + 1. In real life you would also fetch the page here, with an HTTP request. Without this step page stays 1 and the loop only stops at the maximum.

  1. In Add step, choose Transform data
Move the counter on · In Add step, choose Transform data
  1. In Name, type Next page
Move the counter on · In Name, type Next page
  1. Click Remove field
Move the counter on · Click Remove field
  1. Click Remove field
Move the counter on · Click Remove field
  1. In New field, type page
  2. In page, type = page + 1
Move the counter on · In New field, type page; In page, type = page + 1
Step 5 / 6

Put the steps in one line and save

Select the steps (click the first, and the others while holding Shift) and click Align horizontally: they then stand in one line and you read the workflow from left to right; a branch (such as No of an If / Else) gets its own row below. Fit to view puts everything in sight; then Save.

  1. Click ‘Event trigger’
Put the steps in one line and save · Click ‘Event trigger’
  1. Click ‘While there are pages’ while holding Shift
Put the steps in one line and save · Click ‘While there are pages’ while holding Shift
  1. Click Align horizontally
Put the steps in one line and save · Click Align horizontally
  1. Click Fit to view
Put the steps in one line and save · Click Fit to view
  1. Click Save
Put the steps in one line and save · Click Save
Step 6 / 6

Run

The loop ran three times: at page 1, 2 and 3. After that page was 4 and the condition no longer held.

  1. Click Run
Run · Click Run
Run · Status: Completed.
Run · 3 passes done.
Run · page: 4 after the loop.

This guide was carried out step by step on 22 Oct 2026 by an automated test on Flow (version 3e563176).