Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

GlideRecord orderBy is not working

yauheni_karasiu
Tera Expert

GlideRecord method orderBy is not working on sysapproval table if we use dot-walking as an argument in orderBy. See screenshot.

find_real_file.png

18 REPLIES 18

vinothkumar
Tera Guru

Hi Yauheni,



I tried in my instance and it is sorting out by descending order. Can you check it



var m = new GlideRecord('sysapproval_approver');


m.addQuery('sysapproval.sys_class_name=sc_req_item');


m.setLimit(100);


m.orderByDesc('sysapproval');


m.query();


while(m.next())


{


gs.print(m.getDisplayValue('sysapproval.request'));


}


Vinoth,



You are ordering just by "sysapproval", the issue if you use dot-walking, for example "sysapproval.request".



Thank you.


Kannan Nadar
Tera Guru

Hi,



"sysapproval" field is referencing the task table. Can you try the below.



gr.orderByDesc('sysapproval.number')


Hi,



Yes, it's wokring with "sysapproval.number", but I need to sort by field request on the requested item and it's not working again, see screenshot below.find_real_file.png