How to sort advanced reference qualifier for a reference field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2021 03:52 AM
I am using a script include for reference qualifier, but now the list should be sorted . Is there any way this can be achieved?
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2021 03:56 AM
Can you provide your script include code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2021 04:04 AM
Hi
You can use orderByDesc/orderBy to sort the
gr.orderByDesc('field_name'); //descending order
gr.orderBy('field_name'); //ascending order
Example:
var gr = new GlideRecord('incident');
gr.orderBy('number');
gr.orderBy('sys_created_on');//ascending order by created date.
gr.query();
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2021 04:06 AM
Am not really glide recording anything rather just returning an encoded query.
return 'u_category=' + current.u_case_number.u_dispatch.u_category + '^u_field_name=u_billableratecardcategory' + '^u_mapping_type=Value' + '^u_active=true'+'^ORDERBYu_label';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2021 04:17 AM
Looks like orderby is already added, Is it not working?
return 'u_category=' + current.u_case_number.u_dispatch.u_category + '^u_field_name=u_billableratecardcategory' + '^u_mapping_type=Value' + '^u_active=true^ORDERBYu_label';
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP