While Loop
The While Loop node lets you run a block of nodes repeatedly while a condition stays true. It's handy when the number
of repetitions depends on runtime data. Unlike the standard Loop node (which iterates over every item in an input array)
or the Repeat node (which runs a fixed number of times), the While Loop keeps executing until the condition you define
evaluates to false.
When to use the While Loop node
- Polling / waiting for status changes: e.g., keep querying an external API until the response contains a terminal state.
- Progressive transformations: apply a set of nodes until the payload satisfies a rule (size threshold, validation, etc.).
- Retries with custom logic: implement exponential backoffs or conditional exits without writing custom scripts.
Configuring the node
- Condition: Define a boolean expression using the Object Inspector or JSON editor. The loop evaluates this
condition before each iteration. If the result is
true, the loop body runs; otherwise, the loop stops. - Maximum iterations: Safeguard against infinite loops by setting an upper limit. The workflow fails with an error
if the loop hits the cap before the condition becomes
false. - Delay between runs (optional): Add a wait time to avoid hammering downstream systems when polling.
- Loop body: Drag the nodes that should execute each time. They can read/write the workflow context like any other node, so you can update values that the condition depends on.
Use workflow variables to store counters, API responses, or merged state inside the loop. Updating those variables lets the While Loop condition react to changes without extra scripting.
Execution flow
- Evaluate the condition.
- If
true, run every node in the loop body (top to bottom). - Update any referenced variables/outputs.
- Re-run the condition (respecting the optional delay) and repeat the process.
- Stop when the condition returns
falseor the max iteration limit is reached.
Example
Imagine processing invoices until a downstream ERP confirms they are posted:
- Use an HTTP node inside the loop to check the invoice ID.
- If the ERP still reports
pending, log the status, increment a counter, and sleep for 30 seconds. - When the response switches to
posted, store the confirmation and let the loop exit automatically.
This pattern prevents unnecessary workflow branches and keeps the logic readable compared to custom scripts.
Need Help?
- 💬Join BuildShip Community
An active and large community of no-code / low-code builders. Ask questions, share feedback, showcase your project and connect with other BuildShip enthusiasts.
- 🙋Hire a BuildShip Expert
Need personalized help to build your product fast? Browse and hire from a range of independent freelancers, agencies and builders - all well versed with BuildShip.
- 🛟Send a Support Request
Got a specific question on your workflows / project or want to report a bug? Send a us a request using the "Support" button directly from your BuildShip Dashboard.
- ⭐️Feature Request
Something missing in BuildShip for you? Share on the #FeatureRequest channel on Discord. Also browse and cast your votes on other feature requests.