Hi @Ankur Bawiskar There are many many subflows. It will be difficult to set flow outputs and check that in the previous flows every time... I am looking for a more generic solution to this kind of issue that is not really customised for this case.

@Servicenow Use4 

you cannot have generic solution.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Mark Manders
Tera Patron

Any action that is done, should be checking on the case state. So if somewhere in the flow you are calling a next subflow (or within a subflow actions are performed), you need a check on the state of the Case.

I don't know how complicated the flow is, but it could be as easy as just put a look up record to check on the case state and an 'end flow' if it is canceled.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

View solution in original post

Hi @Mark Manders Thanks for responding to my question. I had to do something similar to what you suggested. I had to check if the case is cancelled or not at critical points in my overall flow. If yes, then 'End subflow'.
It worked. Thanks!

Tai Vu
Kilo Patron

Hi @Servicenow Use4 

Have you tried to cancel the flow when the HR Case get cancelled?

Cancels a paused or running flow, subflow, or action.

cancel(String contextId, String reason)

var now_GR = new GlideRecord("sys_flow_context");
now_GR.addQuery("name", "Test Flow");
now_GR.query();
while (now_GR.next()) {
   sn_fd.FlowAPI.cancel(now_GR.getUniqueValue(), 'Canceling Test Flows');
}

 

Cheers,

Tai Vu