Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Limit the amount of records returned to 10

daveramos
Kilo Explorer

I am using the related list incident by same caller and I would like to limit the amount of records returned to 10. This is the script I am trying to use. But it is not limiting the returned records to 10.

Any help is very much appreciated. Thank You.

var gr = new GlideRecord('incident');

current.addQuery('caller_id', Parent.caller_id);

gr.orderByDesc('sys_created_on');

gr.serLimit(10);

gr.query();

2 REPLIES 2

Deepak Ingale1
Mega Sage

var gr = new GlideRecord('incident');


gr.addQuery('caller_id', current.parent.caller_id);


gr.orderByDesc('sys_created_on');


gr.setLimit(10);


gr.query();



Try with above code corrected in bold letters


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi David,



Please refer section 10.5 for reference.


http://wiki.servicenow.com/index.php?title=GlideRecord#setLimit&gsc.tab=0