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.

Scoped equivalent

To use the getAggregate() method in a scoped application, use the corresponding scoped method: Scoped GlideAggregate - getAggregate(String agg, String name).

function doMyBusinessRule(assigned_to, number) {
  var agg = new GlideAggregate('incident');
  agg.addQuery('assigned_to', assigned_to);
  agg.addQuery('category', number);
  agg.addAggregate("COUNT");
  agg.query();
  var answer = 'false';
  if (agg.next()) {
    answer = agg.getAggregate("COUNT");
    if (answer > 0)
      answer = 'true';
    else
      answer = 'false';
  }
  return answer; 
}