Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Choice list not sorting

kenneth2k1
Kilo Expert

Hello!

I have a variable that pulls the choices (sys_choice) from the title column of the user (sys_user) table. They wanted to do a mass update to all the position titles, so I deleted all values from sys_choice for the sys_user table, where the element is "title." This worked fine. Then I did an import from a .xls file I had, and it inserted the updated list of choices.

The problem is, I thought if there was no sequence number, they would be ordered alphabetically, but it's not. We have an order guide which has a variable called "Position title." This is a select box, with a "Choice table" sys_user, and the "Choice field" is Title:

Positiontitle.jpg

This seems to work fine, except when you try and use the order guide and you click on the Position title variable drop-down, the list is all out of order:

PosTitleDropdown.jpg

How can I get this list to be in alphabetical order? Thanks for any help!

1 ACCEPTED SOLUTION

Thanks for the help. I think I found the problem. I realized that previously there was no "label" value, but there was a "title" value (they are the same value, but one was missing). When I re-imported I ensured the data was there for both "label" and "value" fields, and it worked as expected.



I suspect that SN perhaps uses the label value to sort on, even if it is not a mandatory field.


View solution in original post

2 REPLIES 2

Mark Stanger
Giga Sage

Do they sort correctly when displayed on the 'sys_user' form?   It might be a cache issue of some sort.   You might try making an update to one of the choices and then changing it back, or adding an order to a few of them and then blanking that value out again to see if that helps.


Thanks for the help. I think I found the problem. I realized that previously there was no "label" value, but there was a "title" value (they are the same value, but one was missing). When I re-imported I ensured the data was there for both "label" and "value" fields, and it worked as expected.



I suspect that SN perhaps uses the label value to sort on, even if it is not a mandatory field.