Skip to content

Commit 339ff36

Browse files
authored
Create businessRuleFsmUsecase.js
1 parent 7dd93bd commit 339ff36

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(function executeRule(current, previous /*null when async*/) {
2+
3+
if (!current.initiated_from.nil()) {
4+
5+
var inc = new GlideRecord('incident');
6+
if (inc.get(current.initiated_from)) {
7+
8+
// Link the Work Order reference to the Incident
9+
inc.u_work_order = current.sys_id;
10+
11+
// Move the Incident to On Hold and set Hold Reason
12+
inc.state = 3; // 3 = On Hold
13+
inc.hold_reason = '2'; // Awaiting Field Work Order (custom choice value created)
14+
15+
// Add work note
16+
inc.work_notes = 'Work Order ' + current.number + ' has been created and Incident moved to On Hold.';
17+
18+
inc.update();
19+
}
20+
}
21+
22+
})(current, previous);

0 commit comments

Comments
 (0)