- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2020 03:09 AM
Hello,
I have a problem to sort output of a GlideRecord query by datetime field (Date/Time field).
Even if I convert the date/time field to number value, the orderBy function does not work, any idea why?
Appreciate your help,
Milan
var rec = new GlideRecord('sc_request');
rec.orderBy("u_date_from.getGlideObject().getNumericValue()");
rec.query();
while(rec.next()) {
gs.print(rec.number + ' - ' + rec.u_date_from); }
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2020 03:39 AM
Oh Great that things got working & you got to know the issue. Kindly close the thread by marking appropriate answer as correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2020 03:30 AM
Hi Milan,
if that is date/time then it should work as expected
is it not working as expected currently?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2020 03:38 AM
It probably is - there seems to be a data quality issue which confused me a bit...tanks a lot.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2020 03:39 AM
Oh Great that things got working & you got to know the issue. Kindly close the thread by marking appropriate answer as correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2020 03:47 AM
I am glad to hear your goal has been achieved.
Saying this, I will appreciate if you close this thread, as answered.
Have a great rest of the day.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader