Sort Choices by Sequence

Roberto Cortina
Tera Contributor

Hi everyone,

I have a column in one of my tables that stores a Choice value. If I add a sequence number in "Choice Lists" table does that mean choices will be displayed in that order automatically or do I need to add something else to my Encoded Query or Script?

Regards

7 REPLIES 7

Allen Andreas
Administrator
Administrator

Hi,

Not sure what you mean by "add a sequence number" in the choice list table. Is this a custom table and so that'd be a custom field, right? If so, by default, it's not going to sort per that and instead would sort by the name.

You can attempt to use the ORDERBYvalue method to define this within an encoded query and see if that works for you. Documentation found here: https://docs.servicenow.com/bundle/quebec-platform-user-interface/page/use/using-lists/concept/c_Enc...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen,

In the table called sys_choice_list there is a column called "Sequence". It is a out of the box table and the "Sequence" column is also an out of the box field. So, if I fill the sequence column with numeric values, are the choices be sorted by that field automatically or do I need to do something else to sort them by that column?

Regards

Hi,

I'm not seeing a default table called sys_choice_list.

Are you sure that's the name and not sys_choice?

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Yes, you are right, it's called sys_choice. There's a column called "Sequence" on that table.