GlideRecord only 1000 records

Raghu Loganatha
Kilo Guru

Hi,

Just curios to know if we can gliderecord only 100 records. Below is the sample query, In this query i am querying incidents of last three months and lets say there are some 6000 records. For my requirement i need to query only first 1000 records in the query. How can i get that? Or how can i terminate glide after count reaches 1000.

var count = 0;

var gr = new GlideRecord('incident');

gr.orderByDesc('number');

gr.addEncodedQuery('sys_created_onONLast 3 months@javascript:gs.monthsAgoStart(3)@javascript:gs.endOfThisMonth()');

gr.query();

while(gr.next())

{

count = count+1;

}

gs.log(count);

1 ACCEPTED SOLUTION

darius_koohmare
ServiceNow Employee
ServiceNow Employee

have you tried


  1. gr.setLimit(1000);

View solution in original post

3 REPLIES 3

darius_koohmare
ServiceNow Employee
ServiceNow Employee

have you tried


  1. gr.setLimit(1000);

No, let me try that.


thanks , that worked.