GlideRecord - query(Object field, Object value)

Runs the query against the table based on the filters specified by addQuery() and addEncodedQuery().

This method queries the GlideRecord table as well as any references of the table. Usually this method is called without arguments, but a name/value pair can be specified.

Table 1. Parameters
Name Type Description
name Object Field name
value Object Value
Table 2. Returns
Type Description

Scoped equivalent

To use the query() method in a scoped application, use the corresponding scoped method: Scoped GlideRecord - query(Object field, Object value).

var rec = new GlideRecord('incident');
while ( { 
 gs.print(rec.number + ' exists');