- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 10:21 AM
I have a Lookup Select Box on a variable set on a Catalog item that calls a script include in a reference qualifier and passes in the value of the previous Lookup Select Box into the script include. This script include returns a string value that is the reference qualifier. It works fine in returning the correct values. However, the string includes an 'ORDERBY' value that I cannot get the qualifier to honor.
The u_version_sort_order value is an integer value in the table that is referenced by the Lookup Select Box.
I have tried putting the ORDERBY at the front and end of the string.
I have tried ORDERBYDESC in both cases just to make sure I was not confusing things.
I attempted to not include the ORDERBY at all and instead use the ref_ac_order_by attribute on the select box.
Neither of the options above caused a changed in the order of the available options in the select box.
The 'return' statement in the script include that is called:
return 'sys_idIN' + returnObject + '^ORDERBYu_version_sort_order';
EDIT:
The the lookup select box is always ordered ASC by the values returned, which is u_version_name in my table:
I am attempting to get it to order by a u_version_sort_order so that we can account for oddities when strings with alphanumeric values are sorted. In the example below, I intentionally jumbled the version order so that it would be obvious if the lookup select list is sorted or not in testing:
Solved! Go to Solution.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2020 01:42 PM
I opened a Hi portal case for this. This is a known issue. You must switch the Type to Reference and use ref_ac_order_by in the variable attributes field.
https://hi.service-now.com/kb_view.do?sysparm_article=KB0695435

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 10:30 AM
Hi Brad,
In the script include itself where you do a GlideRecord & returnObject did you try applying sorting before the query(); itself. Can you try that once for a check i.e. to return the sys_ids in order before the query() itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 01:44 PM
Yes, I tried gr.orderBy() and gr.orderByDesc() with no change in behavior. I will try it again to be sure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 06:58 AM
I just tried this again and the order is still not honored. Thank you for the suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 11:43 AM