From af91a7b9ed3a62a5ae08cf65fed3dc585982c7b1 Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Fri, 3 Oct 2025 00:31:18 +0530 Subject: [PATCH 1/2] Create script.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Business Rule checks for Change Requests linked to the same Configuration Item (CI) whenever an Incident is created or updated. If any active CRs are found (excluding Closed and Canceled), their numbers are added to the Incident’s work notes. This helps agents identify related changes quickly and avoid duplicate effort. --- .../script.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident/script.js diff --git a/Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident/script.js b/Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident/script.js new file mode 100644 index 0000000000..1ac85cae06 --- /dev/null +++ b/Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident/script.js @@ -0,0 +1,24 @@ +(function executeRule(current, previous /*null when async*/) { + + if(current.cmdb_ci){ + var ci = current.cmdb_ci.getValue(); + + var chng = new GlideRecord('change_request'); + chng.addQuery('cmdb_ci', ci); + chng.addQuery('state', '!=', '3'); + chng.addQuery('state', '!=', '4'); + chng.query(); + + var work_notes = ''; + + while(chng.next()){ + work_notes += chng.getValue('number') + '\n'; + } + + if(work_notes){ + current.work_notes = 'Following change requests are associated with the same CI. You can attach one of them.\n' + work_notes; + } + + } + +})(current, previous); From a6ff2eb89dd384030f4f8853353f5bcbc95d523e Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Fri, 3 Oct 2025 00:32:57 +0530 Subject: [PATCH 2/2] Create README.md --- .../README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident/README.md diff --git a/Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident/README.md b/Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident/README.md new file mode 100644 index 0000000000..ef4c38d3db --- /dev/null +++ b/Server-Side Components/Business Rules/Add work notes for relevant Change Requests for Incident/README.md @@ -0,0 +1,5 @@ +Adds the Change Request numbers to the work notes of incidents that have the same CI. +Operates on the Incident table as a Before Business Rule. + +Excludes CRs that are closed and cancelled. +Helps agents to quickly identify related changes during incident triage.