Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Suggests change requests to attach to the incident record based on CI.
Updates work notes with the numbers of change requests that can be relevant for the incident after incident is created.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(function executeRule(current, previous /*null when async*/) {

// Add your code here
if(current.cmdb_ci){
var ci = current.cmdb_ci;

var chng = new GlideRecord('change_request');
chng.addQuery('cmdb_ci', ci);
chng.addQuery('state', '!=', '3');
chng.addQuery('state', '!=', '4');
chng.query();

var work_notes = 'Following change requests are associated with same CI. You can attach one of them.\n';

while(chng.next()){
work_notes += chng.number + '\n';
}

current.work_notes = work_notes;
current.update();
}

})(current, previous);
Loading