"Wait for Child Tasks to Close" Activity in Flow Designer

Ilo Gassoway
Mega Guru

Has anyone developed a Flow Designer activity for the Service Catalog that mirrors the old "Wait for Child Tasks to close" Workflow activity? I use this in a lot of my catalog item workflows to be sure to allow any manually created catalog tasks are closed before ending the workflow. 

This does not appear to be an out of box activity for flow designer.

18 REPLIES 18

tstocking
Tera Guru

We just started to look at this. The best we came up with is the following Actions/Logic:

  1. Do the following
  2. Look up Catalog Task Records where Request Item is Input -> Requested Item
  3. Active = True
  4. Max Results = 1
  5. Until Count = 0

The problem is the "The maximum amount of iterations that a loop will run in flow designer" property will come into play as this will keep looping until this property value limit is hit. The default is 1000. 

So at this point, we figure we would have to put in a wait for duration activity to spread the number of loop iterations out over time. However, even if we said something like a couple of hours, there is still a threshold that we would hit (1000 x the wait duration). At that point, the flow will error and quit.

So it appears to be a balancing act between not setting the loop maximum too high and not waiting too long but there doesn't appear to be a solid way to deal with hitting the loop limit.

curtisschmidt
Tera Contributor

For anyone else needing a fix for this issue I did find a work around that should not run into the loop max issue:

1.) Create all your tasks you want to monitor for being closed at the same time (i.e. from a For Each loop, a bunch of tasks without wait being set, or a collection of manually added tasks are added to the parent)

2.) Add a Lookup Records (multiple) to find all the tasks  (i.e. active is true and request item / parent is the main record we are working on)

3.) Add a For Each on the Lookup Records result array

4.) In the For Each add a Wait For Condition with the target record set to the current record from the For Each and and Active is False (record has been closed or cancelled).

What this should do is add a specific wait for condition to each of the records to confirm when it is closed that you want to monitor in sequence.  It doesn't matter if records get closed out of order as when the Wait for Condition comes up for that record it will just pass and move on to the next remaining record.

The only downside to this method is that all the tasks you want to monitor need to be created before you do the lookup in step 2.

Depending on how general / specific you want to get with your filter conditions you could probably set this up as a Subflow to reuse as required (passing in the parent record) and may be good to include if you have a shared Subflow for resolving your RITMs at the end (i.e. set state to closed, update the stage, do other company specific clean-up required, etc...).

 

Hope that helps.