diff --git a/Server-Side Components/Background Scripts/Critical Incidents Created Today by assignment group/README.md b/Server-Side Components/Background Scripts/Critical Incidents Created Today by assignment group/README.md new file mode 100644 index 0000000000..1033acbf30 --- /dev/null +++ b/Server-Side Components/Background Scripts/Critical Incidents Created Today by assignment group/README.md @@ -0,0 +1 @@ +Background script to get Count of Critical Incidents Created Today (by Assignment Group) diff --git a/Server-Side Components/Background Scripts/Critical Incidents Created Today by assignment group/script.js b/Server-Side Components/Background Scripts/Critical Incidents Created Today by assignment group/script.js new file mode 100644 index 0000000000..ca8a095f13 --- /dev/null +++ b/Server-Side Components/Background Scripts/Critical Incidents Created Today by assignment group/script.js @@ -0,0 +1,17 @@ +//Count of Critical Incidents Created Today (by Assignment Group) +(function() { + var ga = new GlideAggregate('incident'); + ga.addQuery('priority', '1'); // Critical priority + + var start = new GlideDateTime(); + start.beginningOfToday(); // start of the day + ga.addQuery('sys_created_on', '>=', start); + ga.groupBy('assignment_group'); + ga.addAggregate('COUNT'); + ga.query(); + + gs.print("Critical Incidents Created Today (by Assignment Group):"); + while (ga.next()) { + gs.print((ga.assignment_group.getDisplayValue() || "Unassigned") + " → " + ga.getAggregate('COUNT')); + } +})();