Scoped GlideRecord - query(Object field, Object value)

Runs the query against the table based on the filters specified by addQuery, addEncodedQuery, etc.

This queries the GlideRecord table as well as any references of the table. Usually this is performed without arguments. If name/value pair is specified, "name=value" condition is added to the query.

Table 1. Parameters
Name Type Description
field Object Column name on which to query
value Object Value for which to query
Table 2. Returns
Type Description
void
var rec = new GlideRecord('incident');
rec.query();
while (rec.next()) { 
  gs.info(rec.number + ' exists');
}

Output: