0

setLimit() – This can be used to limit potential performance implications of a large query.

var incidents = GlideRecord('incident');
incidents.setLimit(10);
incidents.orderByDesc('number');
incidents.query();
 while (incidents.next()) {
    gs.info('---> number: ' + incidents.getValue('number'));
}
Use of setLimit() function in ServiceNow
Working Code Asked question September 25, 2023