Sort on Choice table

athavichith
Kilo Sage

I want to sort the Choice table but I dont want have to enter a value on Sequence and then sort by Sequence. Can I use an attribute to sort by label or value?

1 ACCEPTED SOLUTION

Cheikh Ahmadou
Tera Guru

In ServiceNow, the Choice table (sys_choice) does not support automatic sorting by label or value using an attribute on the field. By default, choices are ordered by the sequence field. If sequence is blank, records are generally sorted by label, but this is not guaranteed or configurable via a field attribute.

Otherwise, you can: 
1. override choice list with a client script (not recommended for standard fields)

You can technically override choice order via a client script, but this is fragile and not recommended unless you're dealing with a custom dropdown.

 

2. Use a reference field instead

If you truly need auto-sorted dropdowns without managing sequence manually, consider using a reference field to a custom table (e.g., u_choice_options) where you can sort by name or order naturally.

View solution in original post

3 REPLIES 3

Cheikh Ahmadou
Tera Guru

In ServiceNow, the Choice table (sys_choice) does not support automatic sorting by label or value using an attribute on the field. By default, choices are ordered by the sequence field. If sequence is blank, records are generally sorted by label, but this is not guaranteed or configurable via a field attribute.

Otherwise, you can: 
1. override choice list with a client script (not recommended for standard fields)

You can technically override choice order via a client script, but this is fragile and not recommended unless you're dealing with a custom dropdown.

 

2. Use a reference field instead

If you truly need auto-sorted dropdowns without managing sequence manually, consider using a reference field to a custom table (e.g., u_choice_options) where you can sort by name or order naturally.

SawyanPrabha
Giga Contributor

Hi,

 

ServiceNow doesn't offer a built-in attribute for sorting choices by label or value directly within the Choice table. To accomplish this, significant custom development is required. If you're still interested in pursuing this, please let me know so I can start working on a solution

SawyanPrabha
Giga Contributor

Service Now does not provide a built-in attribute to sort choices by label or value directly in the choice table. So in order to achieve this you will need to do lot of custom development. If you are still willing to move ahead you can reply so that I can work on solution.