From f575a5107277e582e84659fe173011edafcdf287 Mon Sep 17 00:00:00 2001 From: Indra-kolge <123245160+Indra-kolge@users.noreply.github.com> Date: Tue, 14 Oct 2025 16:53:14 +0530 Subject: [PATCH 1/5] IncidentCount.js --- .../IncidentCount.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Get incident count based on priority/IncidentCount.js diff --git a/Server-Side Components/Background Scripts/Get incident count based on priority/IncidentCount.js b/Server-Side Components/Background Scripts/Get incident count based on priority/IncidentCount.js new file mode 100644 index 0000000000..e6b1b099c1 --- /dev/null +++ b/Server-Side Components/Background Scripts/Get incident count based on priority/IncidentCount.js @@ -0,0 +1,15 @@ +(function() { + var priorities = {}; + var agg = new GlideAggregate('incident'); + agg.addAggregate('COUNT'); + agg.groupBy('priority'); + agg.query(); + while (agg.next()) { + var priority = agg.getDisplayValue('priority') || 'No Priority Set'; + var count = agg.getAggregate('COUNT'); + priorities[priority] = parseInt(count, 10); + } + for (var priority in priorities) { + gs.info('Priority: ' + priority + ' | Count: ' + priorities[priority]); + } +})(); From fb7b64d0aa74a0852bc5cc2e2cc1a5fee6d35a5a Mon Sep 17 00:00:00 2001 From: Indra-kolge <123245160+Indra-kolge@users.noreply.github.com> Date: Tue, 14 Oct 2025 16:54:04 +0530 Subject: [PATCH 2/5] README.md --- .../Get incident count based on priority/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Server-Side Components/Background Scripts/Get incident count based on priority/README.md diff --git a/Server-Side Components/Background Scripts/Get incident count based on priority/README.md b/Server-Side Components/Background Scripts/Get incident count based on priority/README.md new file mode 100644 index 0000000000..cce3e61a7e --- /dev/null +++ b/Server-Side Components/Background Scripts/Get incident count based on priority/README.md @@ -0,0 +1 @@ +//To get the incident count based on priority. From bdc8165915b6144345ee00bd0a9155e0a0831744 Mon Sep 17 00:00:00 2001 From: Indra-kolge <123245160+Indra-kolge@users.noreply.github.com> Date: Tue, 14 Oct 2025 17:24:25 +0530 Subject: [PATCH 3/5] RestrictSystemCommentsOnTaskMetric.js --- .../RestrictSystemCommentsOnTaskMetric.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/RestrictSystemCommentsOnTaskMetric.js diff --git a/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/RestrictSystemCommentsOnTaskMetric.js b/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/RestrictSystemCommentsOnTaskMetric.js new file mode 100644 index 0000000000..db015a7322 --- /dev/null +++ b/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/RestrictSystemCommentsOnTaskMetric.js @@ -0,0 +1,16 @@ +//Table: Task Metric Reporting Table. +//When to run:Before update +//Conditions: Updated by is system + +//Script +(function executeRule(current, previous /null when async/ ) { + + var caseSysid = current.u_task_number.sys_id; + var grCase = new GlideRecord('sn_customerservice_case'); + if (grCase.get(caseSysid)) { + var latestEntry = grCase.comments.getJournalEntry(1).toString(); + var latestWorknote = grCase.work_notes.getJournalEntry(1).toString(); + if (latestEntry.includes('System') || latestWorknote.includes('System')) { + current.setAbortAction(true); + } + } From 3c9d40657f618e9e54d1aaa3a865748da8f33e7e Mon Sep 17 00:00:00 2001 From: Indra-kolge <123245160+Indra-kolge@users.noreply.github.com> Date: Tue, 14 Oct 2025 17:25:04 +0530 Subject: [PATCH 4/5] Create README.md --- .../README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/README.md diff --git a/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/README.md b/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/README.md new file mode 100644 index 0000000000..3a3490e7b5 --- /dev/null +++ b/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/README.md @@ -0,0 +1 @@ +//Restrict System Generated Comments from Updating Task metric reporting table record. From f912e7ac8d2cd8fafbd7be4c7671fcf2f572d18e Mon Sep 17 00:00:00 2001 From: Indra-kolge <123245160+Indra-kolge@users.noreply.github.com> Date: Tue, 14 Oct 2025 17:28:17 +0530 Subject: [PATCH 5/5] README.md --- .../README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/README.md b/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/README.md index 3a3490e7b5..e2f58c5a08 100644 --- a/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/README.md +++ b/Server-Side Components/Business Rules/Restrict System Generated Comments from Updating ITIL Metrics/README.md @@ -1 +1 @@ -//Restrict System Generated Comments from Updating Task metric reporting table record. +//Restrict System Generated Comments from Updating ITIL Metrics on the task metric reporting table.