Skip to content

Commit e59b3d6

Browse files
Create Count Incidents.js
1 parent ff32526 commit e59b3d6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(function executeRule(current, previous /*null when async*/) {
2+
3+
var problemSysId = current.sys_id;
4+
var agg = new GlideAggregate('incident');
5+
agg.addQuery('problem_id', problemSysId);
6+
agg.addAggregate('COUNT');
7+
agg.query();
8+
9+
if (agg.next()) {
10+
var incidentCount = agg.getAggregate('COUNT');
11+
gs.addInfoMessage('There are ' + incidentCount + ' incidents related to this problem.');
12+
}
13+
14+
})(current, previous);

0 commit comments

Comments
 (0)