reference field order in drop down

ggg
Giga Guru

I have a choice (drop down) field that is a reference to another table.

I get the value via script.

How do I order the way the values display in the drop down?

it is defaulting to alphabetical.

I know on a choice field you can set the order on the column in the table.

I don't see how to do this for my reference field.

 

1 ACCEPTED SOLUTION

How about trying the dictionary attribute 'ref_sequence'.

More information is available here -https://docs.servicenow.com/bundle/helsinki-platform-administration/page/administer/reference-pages/...

Try setting an dictionary attribute for the variable.

Hope this helps!!

View solution in original post

7 REPLIES 7

rad2
Mega Sage

You might be able to do it in the script using ORDERBY or you can use a Business Rule with option query

Is this in Catalog item or a module. Can you share the variable screenshot

i put an order field (integer) on my ref table record and orderBy in my query.

running script in background the order sequence is correct.

However somehow when it gets to the drop down it is still alphabetical.

Not  sure what you mean by a "BR with option query"

********************************************************

here is my setup:

I have a field, STATUS. let's say values are a, b, c, and z.

they are in a reference data table.

I have a field on my record table referencing the status table.

I need the order in the drop down to be z, c, b, a.

I have an advanced reference qualifier on the field:

javascript: u_status_selection()

u_status_selection is a script include that gets the statuses and returns a comma separated string of sysids in the format:

sys_id IN + s    (s is my string)

 

try the following in the advance reference qualifier

javascript: 'sys_idIN' + s + '^ORDERBYorder'

does not work.

i just hard coded the script in the qualifier and have the sysids in the order in which i want them to appear and

it does NOT work.

still alphabetical.

so it's not the way i return the sysids

sn does something after it gets the list of sysids and make it alphabetical.

how to intercept that action?