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

Hi Yauheni,


i guess since the request field is a reference, its sorting by SysID rather then the number.



thanks


Frank


Frank,

If i use sysapproval.request.number I will face with the same issue. See screenshot below.
find_real_file.png





Thank you!


See below code worked for me:



var gr = new GlideRecord('sysapproval_approver');


gr.setLimit(100);


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


gr.OrderBy('sysapproval.request.number');


gr.query();


while(gr.next())


{


  gs.log('Number '+gr.sysapproval.request.number);


}



Thank you,


Ashutosh Munot



Please Hit Correct, Helpful or like,if you are satisfied with this response.


Ashutosh,



Does it really worked for you? Because for me it doesn't, see screenshot. I just copied your code and pasted to xplore.find_real_file.png


Same Problem i faced initially. For reference fields its not working but string it works fine.



Debugging into this.



Thank you,




Ashutosh munot