Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

In Flow Designer, what is the best way to End flow if ANY task is closed incomplete?

angelas
Tera Contributor

I have a flow that creates 20+ tasks (each one creates once the previous one closes).  There are some if statements in the flow for some conditional tasks.

 

Question:

If any of the tasks are Closed Incomplete, I need the flow to end (stop creating additional tasks), set RITM to Closed Incomplete.


What is the best way to accomplish this?  Is there a way to do this with a subflow or lookup and actions, without adding conditions/scripts to each 'Create Task' action?

 

2 ACCEPTED SOLUTIONS

Josh Pirozzi
Kilo Sage

Hi @angelas,

 

What could work is using an 'If' Flow Logic after each Task and set as:

  • Create Catalog Task action with 'Wait For' Condition
  • 'If' Flow Logic where you check If Task State - Is Not - Closed Incomplete - Generate next task. 

This could provide a solution to not continue the Flow if the Task isn't Closed Complete.

 

Hope this helps!

Josh Pirozzi

View solution in original post

Hi @angelas,

Here you go!

 

Overview:

JoshPirozzi_0-1717186434309.png

 

IF Statement: SC_TASK State is 'Closed Incomplete'

JoshPirozzi_1-1717186462072.png

 

View solution in original post

3 REPLIES 3

Josh Pirozzi
Kilo Sage

Hi @angelas,

 

What could work is using an 'If' Flow Logic after each Task and set as:

  • Create Catalog Task action with 'Wait For' Condition
  • 'If' Flow Logic where you check If Task State - Is Not - Closed Incomplete - Generate next task. 

This could provide a solution to not continue the Flow if the Task isn't Closed Complete.

 

Hope this helps!

Josh Pirozzi

Thank you.

 

In the flow, for the subsequent 'Create Task' actions I have the wait condition checked.

Could you kindly post a sample script or point me to a link to one that would satisfy that If Flow logic?

There is a Data Pill there but it seems like I can only select the 'State' field for the previous Create Task.

 

angelas_0-1717170873385.pngangelas_1-1717170893901.png

 

 

Hi @angelas,

Here you go!

 

Overview:

JoshPirozzi_0-1717186434309.png

 

IF Statement: SC_TASK State is 'Closed Incomplete'

JoshPirozzi_1-1717186462072.png