How can i order a choice list using the Sequence number Not the Value per OOB specs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2019 06:18 AM
We have this issue: Customer wants the choice list value to have 'Other' always at the bottom of the drop down.
Case in point:
Subcategory: Fruits
Choices: Apple,Banana,Cantaloupe,Orange,Kiwi,Mango,Other
when you have a form and the drop down for the choice list, the order comes alphabetically. So Other, comes right after Orange. So I am looking for a script that would accomplish this. I have read numerous SNOW postings all saying that it always use alpha-numeric sorting.
Any help would be appreciated. Oh just for information, I have already tried gs.orderBy('sequence'); in a script includes, and that still doesn't work. Thanks
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2019 07:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2019 07:48 AM
Hi,
I believe you are populating the choices using a script and this is the reason why your sequence order is not auto rendered. Why dont you use the choice list or select box types of fields? It will respoect your sequence OOB.
Again if you still need script, gs.orderBy('sequence'); is not the correct syntax. You should be using
gr.orderBy('sequence'); where gr is your GlideRecord on sys_choice table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2019 03:49 AM
Hello Ailkutty, the order by works in the Self Service side for both New Record and for when the ticket is created. We are using a widget calling a record producer for the user on the Portal Side. This is where I have the problem, as Anhishek clipped a screen print, my issue is not there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2019 03:57 AM
Can you please paste your widget code here? Also did you try changing gs ? gs is GlideSystem class and cannot be used to invoke orderBy.