stopping flow

ma kaiyue
Giga Guru

Can I specify stopping another flow(B) in one flow(A)? Is there a possibility of this?

Thanks in advance!
1 ACCEPTED SOLUTION

Hi @ma kaiyue 

You can use sn_fd.FlowAPI.cancel, check below code snippet to cancel a flow:

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');
}

https://developer.servicenow.com/dev.do#!/reference/api/utah/server/sn_fd-namespace/ScriptableFlowAP...

 

Best Regards
Aman Kumar

View solution in original post

6 REPLIES 6

Community Alums
Not applicable

Hi @ma kaiyue ,

Sorry not sure, what are you looking for here?

 

I am sorry that I did not make it clear.

When an Approval flow is being executed, if the application is withdrawn at this time, so I want to stop the flow that is being executed.

I want to specify the flow that needs to be stopped with a new flow.Is this idea feasible?

 

Thanks!

Hi @ma kaiyue 

You can use sn_fd.FlowAPI.cancel, check below code snippet to cancel a flow:

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');
}

https://developer.servicenow.com/dev.do#!/reference/api/utah/server/sn_fd-namespace/ScriptableFlowAP...

 

Best Regards
Aman Kumar

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @ma kaiyue 

 

Did you mean, to stop execution of flow A from Flow B? What is your use case for same.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************