How to stop flow designer from business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2021 10:28 PM
Hi,
I want to stop flow designer from the Business rule. We have a requirement to copy the state of SCTASK on the RITM. In some catalog items there are more than 1 SCTASKs. I write the below business rule on after , state changes to closed incomplete or state changes to closed skipped
var gr = new GlideRecord('sc_req_item');
gr.get(current.request_item);
//gr.addQuery('sys_id', current.parent);
gr.state = current.state;
gr.stage = 'Request Cancelled';
//gr.setWorkflow(false);
gr.update();
But because of OOTB br(cancel flow on request cancelled) all the sctasks are changing to closed Incomplete.
Please help in this.
Many thanks!!
Saloni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2021 10:37 PM
Hi,
why not update the flow condition?
is flow not stopping from triggering when you use setWorkflow(false)
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2021 10:45 PM
No
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2021 10:39 PM
Hi,
you can use this script to cancel the flow which started
var flow = new GlideRecord("sys_flow_context");
flow.addQuery('name', 'Your Flow Name');
flow.addQuery('source_record', current.getUniqueValue());
flow.query();
if (flow.next()) {
//get your flow's context
var gpa = new sn_ph.GlideProcessAutomation(flow.getValue('sys_id'));
//if the flow isn't terminated (see UI Action condition)
if (!gpa.isTerminated()) {
//cancel the flow and provide the reason
gpa.cancel('Cancelling this flow');
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2021 10:45 PM
Thank you but this is for specific flow. I want for all flow designer.