A subflow waiting for the record on which it was input

Moses E Ali
Tera Contributor

Hi all,

I have a question related to design of a subflow;

If a subflow is called and passed reference to a record as a subflow input, could we use the same record at any step with a wait condition.

 

So for example;

A Service Order is passed as input variable, and then we wait for the status of that Service Order to be changed to Closed Complete, so that we could perform any step ?

 

#flowdesigner #subflow #rome

1 ACCEPTED SOLUTION

Laszlo Balla
ServiceNow Employee
ServiceNow Employee

Hi,

 

Technically you could, but be careful using the "Wait for condition" action, especially to wait for state changes. Your (sub-)flow will be hanging while it waits for the condition to be met, so as a minimum, make sure you configure a reasonable timeout.

Probably a better way for this would be to "detach" the section of your subflow that is after the wait for condition action, and move those steps to a dedicated flow which has a trigger like "Service Order State = Closed Complete". This will not use unnecessary system resources and will lead to better performance (imagine if you had hundreds of service order subflows hanging at times).

 

Hope it helps!

View solution in original post

2 REPLIES 2

Laszlo Balla
ServiceNow Employee
ServiceNow Employee

Hi,

 

Technically you could, but be careful using the "Wait for condition" action, especially to wait for state changes. Your (sub-)flow will be hanging while it waits for the condition to be met, so as a minimum, make sure you configure a reasonable timeout.

Probably a better way for this would be to "detach" the section of your subflow that is after the wait for condition action, and move those steps to a dedicated flow which has a trigger like "Service Order State = Closed Complete". This will not use unnecessary system resources and will lead to better performance (imagine if you had hundreds of service order subflows hanging at times).

 

Hope it helps!

Thank you Laszlo. I also thought the same that there is no restrictions on using Wait Condition but it would be better to use either separate subflow or to avoid any step which makes the subflow wait for prolonged period.