GlideRecordV3 - Client

GlideRecord is used for database operations. Client-side GlideRecord enables the use of some GlideRecord functionality in client-side scripts, such as client scripts and UI policy scripts.

A GlideRecord contains both records and fields.

Queries made with the client-side GlideRecord are executed on the server. Therefore, a request is made from the client browser to obtain the record data.

Client-side GlideRecord is not supported in scoped applications. Instead, create a script include and use GlideAjax, or use the REST APIs.

Clientside GlideRecordV3 - addQuery(String fieldName, Object value)

Adds a filter to return records where the field is equal to the value (or is in a list of values).

Table 1. Parameters
Name Type Description
fieldName String Name of the field to be checked.
value Object The value or list of values on which to query.
Table 2. Returns
Type Description
void

Clientside GlideRecordV3 - addOrderBy(String column)

Adds a column to order by in the query.

Table 3. Parameters
Name Type Description
column String The column by which to order the result set.
Table 4. Returns
Type Description
void

Clientside GlideRecordV3 - addQuery(String fieldName, Object operator, Object value)

Adds a filter to return records where the field meets the specified condition (field, operator, value).

Table 5. Parameters
Name Type Description
fieldName String Name of the field to be checked.
operator Object An operator for the query.
value Object The value to use.
Table 6. Returns
Type Description
void

Clientside GlideRecordV3 - deleteRecord(Function responseFunction)

Deletes the current record.

Table 7. Parameters
Name Type Description
responseFunction Function The response function.
Table 8. Returns
Type Description
Boolean True if the record was deleted. False if no record was found to delete.

Clientside GlideRecordV3 - get(String sysId)

Get a record by sysID.

Table 9. Parameters
Name Type Description
sysId String The sysID of the record for which to search.
Table 10. Returns
Type Description
Boolean True if one or more matching records was found. False if no records were found.

Clientside GlideRecordV3 - getEncodedQuery()

Retrieves all query conditions as an encoded query string.

Table 11. Parameters
Name Type Description
None
Table 12. Returns
Type Description
String An encoded query string containing all conditions that have been added to the query.

Clientside GlideRecordV3 - getTableName()

Gets the name of the table associated with the GlideRecord.

Table 13. Parameters
Name Type Description
None
Table 14. Returns
Type Description
String The table name.

Clientside GlideRecordV3 - GlideRecord(String tableName)

Creates an instance of the GlideRecord class for the specified table.

Table 15. Parameters
Name Type Description
tableName String The table to be used.
var gr = new GlideRecord('incident');

Clientside GlideRecordV3 - hasNext()

Determines if there are any more records in the GlideRecord.

Table 16. Parameters
Name Type Description
None
Table 17. Returns
Type Description
Boolean True if there are more records in the query set.

Clientside GlideRecordV3 - insert(Function responseFunction)

Inserts a new record using the field values that have been set for the current record.

Table 18. Parameters
Name Type Description
responseFunction Function The response function.
Table 19. Returns
Type Description
String The sys_id of the inserted record, or null if the record was not inserted.

Clientside GlideRecordV3 - next()

Moves to the next record in the GlideRecord.

Table 20. Parameters
Name Type Description
None
Table 21. Returns
Type Description
Boolean False if there are no more records in the query set.

Clientside GlideRecordV3 - orderBy(String column)

Specifies an orderBy column. May be called more than once to order by multiple columns.

Table 22. Parameters
Name Type Description
column String The column to add to sort the result set.
Table 23. Returns
Type Description
void

Clientside GlideRecordV3 - query()

Performs a query. Takes zero or more parameters. Parameters may be in any order. Any function is considered to be a response function. Any pair of literals is considered a query pair (field : value).

Do not make synchronous query calls. Performing a query without a response function makes the call synchronous, which means that the display will wait for the query response before continuing.

Table 24. Parameters
Name Type Description
responseFunction Function The function called when the query results are available. (optional)
name String A field name. (optional)
value String The field value to check for. (optional)
Table 25. Returns
Type Description
void
// synchronous, no response function, DO NOT USE
query(); 
// 
// asynchronous, calls the responseFunction when done 
query(responseFunction) 
//
// synchronous, adds "category=hardware" to current query conditions, and does a query, DO NOT USE
query('category', 'hardware') 
//
//asynchronous, adds "category=hardware" to current query conditions, does a query, and calls responseFunction 
query('category', 'hardware', responseFunction)