Scoped GlideAggregate - query()

Issues the query and gets the results.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
void
var count = new GlideAggregate('incident');
count.addAggregate('COUNT');
count.query();
var incidents = 0;
if (count.next()) {
   incidents = count.getAggregate('COUNT');
}
gs.info('Number of incidents: ' + incidents);