Skip to content

Commit bdcc459

Browse files
authored
script.js
1 parent de3ed58 commit bdcc459

File tree

1 file changed

+40
-0
lines changed
  • Server-Side Components/Background Scripts/Generate Report in Logs

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Script: Generate Report in Logs
2+
// Author: Bhavya
3+
// Purpose: Print summary counts for incidents in the system logs
4+
5+
(function() {
6+
gs.print("=== Incident Summary Report ===");
7+
8+
// Total number of incidents
9+
var total = new GlideAggregate('incident');
10+
total.addAggregate('COUNT');
11+
total.query();
12+
total.next();
13+
gs.print("Total Incidents: " + total.getAggregate('COUNT'));
14+
15+
// High Priority incidents
16+
var high = new GlideAggregate('incident');
17+
high.addQuery('priority', 1);
18+
high.addAggregate('COUNT');
19+
high.query();
20+
high.next();
21+
gs.print("High Priority Incidents: " + high.getAggregate('COUNT'));
22+
23+
// Active incidents
24+
var active = new GlideAggregate('incident');
25+
active.addQuery('active', true);
26+
active.addAggregate('COUNT');
27+
active.query();
28+
active.next();
29+
gs.print("Active Incidents: " + active.getAggregate('COUNT'));
30+
31+
// Resolved incidents
32+
var resolved = new GlideAggregate('incident');
33+
resolved.addQuery('state', 6); // Resolved
34+
resolved.addAggregate('COUNT');
35+
resolved.query();
36+
resolved.next();
37+
gs.print("Resolved Incidents: " + resolved.getAggregate('COUNT'));
38+
39+
gs.print("=== End of Report ===");
40+
})();

0 commit comments

Comments
 (0)