Scoped GlideAggregate - getAggregate(String agg, String name)

Gets the value of an aggregate from the current record.

Table 1. Parameters
Name Type Description
agg String The type of the aggregate, for example, SUM or Count.
name String Name of the field to get the aggregate from.
Table 2. Returns
Type Description
String The value of the aggregate.
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);

Output: Number of incidents: 63