Can I add the SetLimit & OrderBy in the encodeQuery()
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2020 04:11 AM
Hi All,
Can I add the setLimit() and OrderBy in the encodeQuery.
I understand since its a function/operation can it be ?
Thanks,
Uma
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2020 04:14 AM
setLimit & orderBy are methods.
setLimit recieves an integer number input in OrderBy method you pass the field name by which orderBy is to be applied.
Although following will work:
gr.setLimit(20);
gr.addEncodedQuery();//This will work
gr.orderBy("field");
Thanks
Sudhanshu

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2020 04:15 AM
Hello,
you can call the method with encodeQuery method
ex
var recSysapproval = new GlideRecord('sysapproval_approver');
recSysapproval.addEncodedQuery(current.sys_id);
recSysapproval.orderByDesc('sys_created_on');
recSysapproval.setLimit(3);
recSysapproval.query();
Mark it as Helpful/Correct if it Helps you