Turnstile / loop counter in a subflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
I am designing a subflow that needs to perform up to a specified number of checks for a condition. Looking for an approach that will be equivalent to a workflow turnstile, or a counter to use in the loop. Any recommendations?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
There is no direct option available. You can follow the below steps:
1) Create a flow variable with name iteration_count
2) Create a Do Until loop with condition iteration_count is less than the number of iterations
3) Within the loop add your code
4) at the end of look before the condition step add a step to set the flow variable
5) Update the Inline Script of Data as below
Note: Use Iteration Count instead of Position in the above screen shot
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
59m ago
Hi @ILYA STEIN ,
You can use the flow logic as - Do the following until or For Each loop
1. Do the following until
2. For Each
Please mark my answer correct and helpful if this works for you
Thanks,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
49m ago
Hi @ILYA STEIN ,
you can try below approaches :
🔹Approach 1: Use a Counter Data Pill in the Subflow
Add an Integer input to your subflow, e.g., max_attempts.
Initialize a local counter (data pill → Integer, start at 0).
Inside the subflow:
Add an If condition:
If counter < max_attempts → perform check.
Else → exit the subflow.
After performing the check, increment the counter by 1.
If the condition still isn’t satisfied, call the same subflow again (recursive approach).
This gives you a turnstile-like loop.
🔹Approach 2: Use a "For Each / Repeat" Loop Action
Flow Designer has a "Do Until" pattern by using "For Each Item" with a generated list.
You can generate a list of numbers from 1 → max_attempts (via Script step).
Then in the loop body, perform the check and use “Break” action (subflow return) when condition is met.
🔹Approach 3: Use Script Step for Counter Logic
If you’re okay embedding some script:
Add a Script step with something like:
var attempts = 0;
var max = fd_data.max_attempts; // from subflow input
var success = false;
while (attempts < max) {
attempts++;
if (/* your check condition */) {
success = true;
break;
}
}
fd_data.success = success;
fd_data.attempts_used = attempts;
Return success/failure and attempts count as outputs.
This is closest to the old workflow “turnstile” activity and very efficient.