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]); + } +})(); 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. 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..e2f58c5a08 --- /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 ITIL Metrics on the task metric reporting table. 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); + } + }