Scoped GlideAggregate - addAggregate(String agg, String name)

Adds an aggregate.

Table 1. Parameters
Name Type Description
agg String Name of the aggregate to add, for example, COUNT, MIN, or MAX
name String Name of the column to aggregate. Null is the default.
Table 2. Returns
Type Description
var count = new GlideAggregate('incident');
var incidents = 0;
if ( {
   incidents = count.getAggregate('COUNT');
//Number of incidents varies depending on the current state
//of the incident table'Number of incidents: ' + incidents);