Do the Following Untill action in Flow Designer is not working as Expected

Madhan007
Tera Contributor

Hi Everyone,

I have defined a Do the following until action in a flow where it runs until catalog task state is false. Inside the loop there is Wait for condition loop, catalog task state is false (with Timeout enabled for 24 hrs).
So even if the Until condition is never satisfied, the action started executing at 29/09/2025 with one day waiting period inside the loop could not have gone more than 62 loops until today. but the flow is throwing an error after the loop is executed for 1000 times having the Iteration limit reached.

Flow action : 

Madhan007_0-1764613195599.png

Flow Execution error sample :

Madhan007_1-1764613296956.png

 

As per logic, the Do the following until loop started executing at 29/09/2025 could not have Iterated for more than 62 times (considering until today). 

Are there any known errors with Do the following until action like while checking the until condition after going through an Iteration, even the state of task is made false, it not considering the updated value like that?

Any Insights into this is very much Appreciated. Thanks in Advance!!!


 

1 ACCEPTED SOLUTION

Hi @Madhan007 

People often think "Wait for Condition" means "Wait while this condition is true." It actually means "Wait until this condition becomes true.

The Scenario happening in your flow:

  1. Iteration 1 starts: Flow looks at Catalog Task pill. Value: Active = True.

  2. Wait Step: (Skipped in 58ms due to config issue mentioned above).

  3. End of Loop (Until): Flow checks the Catalog Task pill.

    • Crucially: It is still looking at the snapshot of the task from when the flow started.

    • It sees Active = True.

    • Loop repeats.

  4. Iteration 2 starts: Nothing has forced the Flow to refresh that data pill.

  5. End of Loop: It checks the stale snapshot again. Active = True.

Because the "Wait" isn't pausing execution, this loop spins 1000 times in under a second, constantly checking a stale version of the record.

  • Do the Following Until...
     **Look Up Record** (Table: SC Task, SysID: [Your Task SysID])
     **This step forces ServiceNow to grab the latest status from the database.*
     **Wait for a duration of time** (Duration: 1 Day)
     **This replaces your "Wait for Condition". It guarantees the loop pauses for 24 hours, preventing the 1000-loop error.*
    Your other logic: Get Variables, Set Flow Variables

  • Until...

    • CRITICAL: In the condition here, do not use the pill from the Trigger/Create step.

    • Use the Record Pill from the "Look Up Record" step (Step 2) inside the loop.

Happy to help! If this resolved your issue, kindly mark it as the correct answer ✅  and Helpful and close the thread 🔒 so others can benefit too.

Warm Regards,

Deepak Sharma

Community Rising Star 2025

 

 

 

 

 

 

View solution in original post

5 REPLIES 5

Deepak Shaerma
Mega Sage
Mega Sage

Hi @Madhan007 

 

Replace your "Wait for Condition" action with the explicit Wait for a duration of time action.

​Action: Logic > Wait for a duration of time

​Duration: 1 Day (or 24 Hours)

 

 

If you need more explaining, please let me know.

 

Happy to help! If this resolved your issue, kindly mark it as the correct answer ✅ and Helpful and close the thread 🔒 so others can benefit too.

Warm Regards,

Deepak Sharma

Community Rising Star 2025

SanjivMeher
Mega Patron
Mega Patron

The following link may help.

https://www.servicenow.com/community/workflow-automation-forum/flow-designer-do-the-following-until-...

 

I would check the Wait for Condition which says 1 day but got executed in 58 ms without waiting. Do you have the right time there?


Please mark this response as correct or helpful if it assisted you with your question.

Madhan007
Tera Contributor

Hey @SanjivMeher @Deepak Shaerma , Thanks for you reply.
In Wait for condition action, condition is set as sc_task.state = false with Timeout =24 hrs. so if that step finished running in 58 ms which can only mean that the state is false, then why not it came out of of the loop, since the untill condition is set as sc_task.state = false ?

Also I dont understand how changing the wait for condition to wait for Duration helps if it is not exiting the loop even though rhe condition is satisfied

Hi, @Madhan007 .

The data pill set in the IF statement is based on the value of the fourth action. Therefore, if the value obtained from the fourth action has been modified after that action, it is necessary to re-evaluate the IF statement by retrieving that value again. For example, this could be implemented by using a flow variable to store the current value obtained from the action as needed, and then having the IF statement reference that value. This would be a change to the your flow logic.

 

regards.

If my answer was helpful, please click the Good button or close it as resolved.