What You'll Learn
By the end of this article, you'll know how to use conditional branching, iterate over lists with For Each and While loops, manage pagination for large datasets, use variables to track state across steps, and prevent one of the most destructive recipe failure modes: the infinite trigger loop.
If / Else If / Else Conditions
Use If conditions to branch your recipe logic. Conditions evaluate data from previous steps and direct the recipe down different paths depending on whether the condition is met.
Important scoping rule: Each condition step evaluates only the data of the current item being processed. It does not look across a list. To evaluate conditions across multiple objects, you need a loop.
Loops: Repeat For Each
Use Repeat For Each to iterate over a list of objects — for example, all projects returned by an API call. For each item in the list, the actions inside the loop execute once.
Setting up Repeat For Each correctly
Add a Repeat For Each step to your recipe.
In the Input List field, insert the data object that contains the list. In PlanRadar, this is always the data attribute (Occasionally included or relationships )of the API response (look for the list icon next to it in the data picker).
Inside the loop, add your conditions and actions. These will execute once per item.
Within the loop, reference attributes of the current item from the For Each step's output — not from the original list variable.
Loops: Repeat While (Pagination)
While loop does have a number of other uses but handling pagination is the most frequent one.
The PlanRadar API returns results in pages, with a default page size of 100 objects. If your data exceeds the page size, a single API call will not return the full dataset.
Two approaches to pagination
Step 1 — Increase the page size parameter: Add page_size=500 to your API call. This is a maximum value and it will increase the number of of objects per page.
Step 2 — Repeat While loop: In each iteration, call the API endpoint to retrieve a page of results until all results are retrieved.
Implementing pagination with Repeat While
Create a variable (e.g. count) and set its initial value to 1.
Inside the Repeat While loop, make your API call using the count variable as the page parameter.
After the API call, increment count by 1 (count = count + 1).
Set the While condition to continue looping as long as the API response returns results (e.g. while the number of results is greater than 0). When the API returns an empty page, the loop exits.
⚠️ Warning: Repeat While Loops Are Infinite By Default
A Repeat While loop has no built-in exit condition. If you misconfigure the exit condition — or forget to add one — the loop will run indefinitely. This will rapidly exhaust your monthly task allocation and can trigger the API rate limit, causing your token to be blocked.
Always define a clear, tested exit condition before activating any recipe containing a Repeat While loop.
Stop Job
The Stop Job action immediately terminates the current recipe run. You can configure it to report the result as either succeeded or failed, and provide a reason string.
Use Stop Job when a condition is met that makes further processing unnecessary or undesirable.
Preventing Infinite Trigger Loops
When a recipe is triggered by a ticket or project update and then itself makes an update to that same object, it can re-trigger itself — creating an infinite loop that runs until your task allocation is exhausted.
⚠️ Warning: Infinite Loops Will Consume Your Entire Task Allocation
An unchecked infinite trigger loop can exhaust 1,000 tasks in minutes. All other running recipes will then stop and will have to be restarted manually.
This is one of the most common and most damaging mistakes in PRC recipe building. Always implement one of the protections below before activating any update-triggered recipe.
How to prevent infinite trigger loops
Check the Origin User Agent (recommended): Add a trigger condition that checks: origin_user_agent does not contain workato.
When PlanRadar Connect makes an API update, the origin user agent field in the request contains a reference to Workato. By excluding these events at the trigger level, the recipe ignores its own updates and only fires on genuine user-driven changes.
Variables
Variables allow you to store and update values during a recipe run. Create them using the Workato Variables tool → Create Variable action.
Common use cases:
Tracking a page counter in a Repeat While loop (e.g. the current page number for pagination).
Building up a list of values across multiple steps before making a batch API call.
Storing intermediate results that need to be referenced in later steps.
Update a variable's value at any point using the Update Variable action.
Project Properties & Environment Variables
For values used repeatedly across multiple recipes (e.g. a standard user ID, a customer reference), use Project Properties or Environment Variables rather than hardcoding them into individual recipes.
Scope | Setup | Availability |
Project Properties | Open the Project → Settings → Project Properties | Available across all recipes within that project |
Environment Variables | Configured at the account level | Available across all projects and all recipes |
The main advantage: If a value changes, update it in one place and it propagates everywhere it is referenced automatically.
Comments
0 comments
Please sign in to leave a comment.