Flow - How to properly wait for ALL sc_task records to be completed?

G24
Kilo Sage

Hello Gurus.  Can someone please give me a COMPLETE and DETAILED solution for the following common problem?

 

I have a flow.  In the flow various service catalog Tasks are automatically generated.  And maybe while working on those tasks, some users MANUALLY generate some additional service catalog tasks.

 

At the end of the flow, if ALL TASKS ARE CLOSED, I want to update my sc_req_item state.  I should do that, right?

 

Question

What is the Standard / Proper / Elegant way to achieve this?  I'm having trouble finding a complete solution.  I see a complex business rule here .  I think it is an "After Update" business rule on the sc_task table...  But WHY do I have to drop out of the Flow and use a Business Rule???  Then it seems like future developers will be wondering how items are magically getting closed.

 

Wouldn't it be better to have a Flow Action of some sort, so everything is clear and visible IN the flow?  Has anyone created such an action, and if so, could you share please?  Or if that is a bad way of doing things, can someone please explain WHY Flow itself cannot be used to model this?  Thanks!!

2 ACCEPTED SOLUTIONS

Peter Bodelier
Giga Sage

Hi @G24,

 

Create a subflow.

Input: RITM (reference to sc_re_item)

Output : Active found True / false (default is true)

 

Action Look up Record on sc_task table, active is true, ritm is current ritm.

 

- If any active task found,

   Create wait for condition, active of that task is false.

   End flow

 

If no task found set Output Active found to false.

 

In your main flow after you have finished with your automic tasks and logic:
Create a do the following until.

Call the subflow in it.

Do the following until condition : subflow output Active found is false.

 

After that proceed with closing the ritm.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

G24
Kilo Sage

Building on what was proposed by @Peter Bodelier solution is as follows:

 

Create a reusable "Gather Task Status" SubFlow which can be reused and will either 1) WAIT on an unfinished task if one exists, or 2) Return a flag indicating that all tasks were in fact completed.  I added some integers also, to indicate how many Complete, Incomplete, and Skipped tasks there were, but that is icing on the cake, and could be skipped.

 

The overall subflow looks like this:

00.png

The inputs and outputs look like this:

InputsAndOutputs.png

Individual flow actions look as follows:

01.png02.png03.png04.png

05.png

06.png07.png08.png

09.png10.png11.png12.png

13.png14.png

 

The subflow is used inside of a regular Catalog flow as follows:

MainFlow.png

The details of those Flow actions are as follows:

19.png20.png21.png22.png

 

Then at runtime, after all tasks are closed Closed Complete, Closed Incomplete, or Closed Skipped, like this:

Tasks.png

 

The Catalog Item will be closed, like this.  Woohoo! ...

Result.png

 

Optional updating of comment field looks as follows:

CommentField.png

 

The End.  Please mark helpful if this helped you in some way!

View solution in original post

15 REPLIES 15

Peter Bodelier
Giga Sage

Hi @G24,

 

Create a subflow.

Input: RITM (reference to sc_re_item)

Output : Active found True / false (default is true)

 

Action Look up Record on sc_task table, active is true, ritm is current ritm.

 

- If any active task found,

   Create wait for condition, active of that task is false.

   End flow

 

If no task found set Output Active found to false.

 

In your main flow after you have finished with your automic tasks and logic:
Create a do the following until.

Call the subflow in it.

Do the following until condition : subflow output Active found is false.

 

After that proceed with closing the ritm.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi @Peter Bodelier ,

 

I was trying your solution. But unable to do the step after this:

Samiksha2_0-1720442246815.png

Samiksha2_1-1720442304297.pngSamiksha2_2-1720442319677.pngSamiksha2_3-1720442336906.pngSamiksha2_4-1720442358105.png

Please help me here.

 

Thanks,

Sam

G24
Kilo Sage

Building on what was proposed by @Peter Bodelier solution is as follows:

 

Create a reusable "Gather Task Status" SubFlow which can be reused and will either 1) WAIT on an unfinished task if one exists, or 2) Return a flag indicating that all tasks were in fact completed.  I added some integers also, to indicate how many Complete, Incomplete, and Skipped tasks there were, but that is icing on the cake, and could be skipped.

 

The overall subflow looks like this:

00.png

The inputs and outputs look like this:

InputsAndOutputs.png

Individual flow actions look as follows:

01.png02.png03.png04.png

05.png

06.png07.png08.png

09.png10.png11.png12.png

13.png14.png

 

The subflow is used inside of a regular Catalog flow as follows:

MainFlow.png

The details of those Flow actions are as follows:

19.png20.png21.png22.png

 

Then at runtime, after all tasks are closed Closed Complete, Closed Incomplete, or Closed Skipped, like this:

Tasks.png

 

The Catalog Item will be closed, like this.  Woohoo! ...

Result.png

 

Optional updating of comment field looks as follows:

CommentField.png

 

The End.  Please mark helpful if this helped you in some way!

Nicely implemented!


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.