File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Server-Side Components/Business Rules/Automatically Populate Incident with Work Order Number Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 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 ) ;
You can’t perform that action at this time.
0 commit comments