How can I get a reference field's pick list to display in a sorted order?

HugoFirst
Kilo Sage

How can I get a reference field's pick list to display in a sorted order?

Detail:

On a change request form I have a reference field pointing to another table named u_std_change_list.   U_std_change_list is a custom table and the 2 fields of interest are:
  u_std_change_list_group
  u_std_change_list_item

Both fields display when we click the magnifying glass icon, but the order is random.
We'd like to sort it by u_std_change_list_group and then by u_std_change_list_item.


What we've tried:
After reading http://wiki.servicenow.com/index.php?title=Customizing_Choice_Lists with no help.
Looked at http://wiki.servicenow.com/index.php?title=Dictionary_Attributes and
http://wiki.servicenow.com/index.php?title=Auto-Complete_for_Reference_Fields

We found ref_ac_order_by and ref_sequence.   But neither appears to have an effect.
We tried both, individually,   as attributes on the u_std_change_list table and in the reference field in the form.   No effect was seen at either place.

What am I missing?

5 REPLIES 5

andrew_venables
ServiceNow Employee
ServiceNow Employee

Hi Hugo,



If you check this page System Dictionary - ServiceNow Wiki there is a field listed at the bottom referred to as Defaultsort, its not on the dictionary form by default buy you can add it on personalising the form. So what you want to do is set the defaultsort value on the u_std_change_list.u_std_change_list_group to be 0 and u_std_change_list.u_std_change_list_item to be 1.



BUT as the wiki states "Sets the sort order of records displayed for the table when there is no other sort specified." this sort is only applied when no other sort has been specified. The most common way a sort is specified is by the user clicking the header of the list. ServiceNow will remember the users sort preference for every single table so all you can do is set the default, the user can always override it and it will be remembered.



Hope this helps,



Andy


Check this link:


http://wiki.servicenow.com/index.php?title=Auto-Complete_for_Reference_Fields



It provides all info how to setup custom sorting for reference fields.


Thank you for the pointer andrew.venables.     I gave this a shot, but it has no effect on the list that I can see.


In testing, I impresonated several users who have not previously viewed the list and it appears to be a random order to the list.  



Thank you eican also!     I did view that page and I tried the attributed of ref_ac_order_by on the form variable which does the referencing.   The result is no effect that I can see.


Thank you for the advice though.   I'm beginning to think that there is a customization buried deep in our instance that disallows custom sorts.


Try adding this to the beginning of the attribute field: ref_auto_completer=AJAXTableCompleter



This has to be present for me in order for any of the "ref_..." attributes to work.



More info here: Auto-Complete for Reference Fields - ServiceNow Wiki