GlideRecord orderBy is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 12:58 AM
GlideRecord method orderBy is not working on sysapproval table if we use dot-walking as an argument in orderBy. See screenshot.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 01:42 AM
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'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 01:49 AM
Vinoth,
You are ordering just by "sysapproval", the issue if you use dot-walking, for example "sysapproval.request".
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 01:43 AM
Hi,
"sysapproval" field is referencing the task table. Can you try the below.
gr.orderByDesc('sysapproval.number')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 01:51 AM