We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f771b3 commit c231ab4Copy full SHA for c231ab4
Server-Side Components/Business Rules/Cancel Incomplete Playbooks on Closure/script.js
@@ -0,0 +1,15 @@
1
+(function executeRule(current, previous /*null when async*/) {
2
+
3
+ // Find associated playbooks
4
+ var playbookGR = new GlideRecord('sys_pd_context');
5
+ playbookGR.addQuery('input_table', 'incident');
6
+ playbookGR.addQuery('input_record', current.sys_id);
7
+ playbookGR.addQuery('state', 'NOT IN', 'completed,canceled');
8
+ playbookGR.query();
9
10
+ // Cancel them to avoid hanging context
11
+ while (playbookGR.next()) {
12
+ sn_playbook.PlaybookExperience.cancelPlaybook(playbookGR, 'Canceled due to the incident closure or cancellation.');
13
+ }
14
15
+})(current, previous);
0 commit comments