- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2022 08:08 AM
For example, Playbook A is triggered, then the SIR record's Category changes, which triggers Playbook B. When this happens, I want Playbook A to stop running.
Solved! Go to Solution.
- Labels:
-
Security Incident Response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2022 11:26 AM
SOLUTION: almost all of my Playbook Triggers are based on SIR Category field...
I created a before Update Business Rule, when Category changes on SIR record.
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var now_GR = new GlideRecord("sys_flow_context");
now_GR.addQuery("source_record", current.sys_id);
now_GR.query();
while (now_GR.next()) {
sn_fd.FlowAPI.cancel(now_GR.getUniqueValue(), "Previous Flow has been canceled");
}
var oldTask = new GlideRecord("sn_si_task");
oldTask.addQuery("parent", current.sys_id);
oldTask.query();
while (oldTask.next()) {
oldTask.state = 7; //State value 7 = Canceled
oldTask.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2022 01:06 PM
Vincent,
I think this KB will help you.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0750702
You'll want to be sure to include the correct conditions on the Business Rule that you create.
Brad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2022 11:26 AM
SOLUTION: almost all of my Playbook Triggers are based on SIR Category field...
I created a before Update Business Rule, when Category changes on SIR record.
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var now_GR = new GlideRecord("sys_flow_context");
now_GR.addQuery("source_record", current.sys_id);
now_GR.query();
while (now_GR.next()) {
sn_fd.FlowAPI.cancel(now_GR.getUniqueValue(), "Previous Flow has been canceled");
}
var oldTask = new GlideRecord("sn_si_task");
oldTask.addQuery("parent", current.sys_id);
oldTask.query();
while (oldTask.next()) {
oldTask.state = 7; //State value 7 = Canceled
oldTask.update();
}
})(current, previous);