GlideRecord - setLimit(Number limit)

Sets the limit for how many records are in the GlideRecord.

Table 1. Parameters
Name Type Description
limit Number Limit for records to fetch.
Table 2. Returns
Type Description
void

Scoped equivalent

To use the setLimit() method in a scoped application, use the corresponding scoped method: Scoped GlideRecord - setLimit(Number maxNumRecords).

var gr = new GlideRecord('incident');
gr.orderByDesc('sys_created_on');
gr.setLimit(10);
gr.query();