is there a way to sort the options that we add to a list with g_form.addOption()?

sharmavikrant
Kilo Expert

is there a way to sort the options that we add to a list with g_form.addOption()?

16 REPLIES 16

Daryll Conway
Giga Guru

You could build an array of the existing options, add yours then use .sort() for the array.



This will give you some guide lines JavaScript Array sort() Method


You can also order your GlideRecord query...


GlideRecord - ServiceNow Wiki