File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ Adds the Change Request numbers to the work notes of incidents that have the same CI.
2+ Operates on the Incident table as a Before Business Rule.
3+
4+ Excludes CRs that are closed and cancelled.
5+ Helps agents to quickly identify related changes during incident triage.
Original file line number Diff line number Diff line change 1+ ( function executeRule ( current , previous /*null when async*/ ) {
2+
3+ if ( current . cmdb_ci ) {
4+ var ci = current . cmdb_ci . getValue ( ) ;
5+
6+ var chng = new GlideRecord ( 'change_request' ) ;
7+ chng . addQuery ( 'cmdb_ci' , ci ) ;
8+ chng . addQuery ( 'state' , '!=' , '3' ) ;
9+ chng . addQuery ( 'state' , '!=' , '4' ) ;
10+ chng . query ( ) ;
11+
12+ var work_notes = '' ;
13+
14+ while ( chng . next ( ) ) {
15+ work_notes += chng . getValue ( 'number' ) + '\n' ;
16+ }
17+
18+ if ( work_notes ) {
19+ current . work_notes = 'Following change requests are associated with the same CI. You can attach one of them.\n' + work_notes ;
20+ }
21+
22+ }
23+
24+ } ) ( current , previous ) ;
You can’t perform that action at this time.
0 commit comments