Cancel flow designer from a server side script

deepika46
Tera Contributor

Hello experts,

 

Is there a way to cancel a flow designer flow from a server side script running on a RITM. Thanks in advance!

7 REPLIES 7

Yes, in that table in the source, i am able to get the RITM sys_id but still it is showing me the same error. I am running it from background script. 

var now_GR = new GlideRecord("sys_flow_context");
now_GR.addQuery("source_record", "436c8d344732211092c98021336d43aa"); //Replace with the sys_id of your RITM
now_GR.query();

while (now_GR.next()) {
gs.log("to check if it exists"); // to check if record exists or not
sn_fd.FlowAPI.cancel(now_GR.getUniqueValue(), 'Canceling Test Flows');
} 

I am even adding a log statement. The log statement is getting printed but i am getting that error. Dont know where the issue lies

Can you test a RITM which has a flow designer attached to it and run your script in the background. I think u will face the same issue.