Can I add the SetLimit & OrderBy in the encodeQuery()

Uma8
Kilo Contributor

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

Sudhanshu Talw1
Tera Guru

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

Ankush Jangle1
Kilo Guru

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