Ankur Bawiskar
Tera Patron

@preethigovi 

since you only want 100 records, please use setLimit()

var shortDescription = "Discuss New Hire's Career Journey";
var gr = new GlideRecord('incident');
gr.addQuery('short_description', 'LIKE', shortDescription);
gr.setLimit(100);
gr.query();
var sysIds = [];
while (gr.next()) {
    sysIds.push(gr.getValue('sys_id'));
}
gs.info('Sys IDs: ' + sysIds.join(', '));

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post