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:48 AM
Hi Yauheni,
i guess since the request field is a reference, its sorting by SysID rather then the number.
thanks
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 01:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 02:19 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 02:34 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 02:44 AM
Same Problem i faced initially. For reference fields its not working but string it works fine.
Debugging into this.
Thank you,
Ashutosh munot