- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 01:35 AM
Hello Everyone,
I want to Cancel the Flow Designer for the current record via Background Script. how to do it?
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', 'xxxxx');
gr.query();
if(gr.next()){
gr.state=Closed;
gr.update();
}
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 03:26 AM
@Vamsi43 Please refer to this support article https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0959612
Here is a sample from it.
var now_GR = new GlideRecord("sys_flow_context");
now_GR.addQuery("name", "NAME OF FLOW TO CANCEL HERE");
now_GR.query();
while (now_GR.next()) {
sn_fd.FlowAPI.cancel(now_GR.getUniqueValue(), 'Canceling Test Flows');
}
Please mark the response helpful and accepted solution if it manages to answer your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 03:26 AM
@Vamsi43 Please refer to this support article https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0959612
Here is a sample from it.
var now_GR = new GlideRecord("sys_flow_context");
now_GR.addQuery("name", "NAME OF FLOW TO CANCEL HERE");
now_GR.query();
while (now_GR.next()) {
sn_fd.FlowAPI.cancel(now_GR.getUniqueValue(), 'Canceling Test Flows');
}
Please mark the response helpful and accepted solution if it manages to answer your question.