Skip to content

Commit f640dee

Browse files
CountIncidents.js
1 parent ff32526 commit f640dee

File tree

1 file changed

+16
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)