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

Harish KM
Kilo Patron
Kilo Patron

Hi Vikrant,



      you can use choiceindex method to sort the value.refer section 12.1 "GlideForm (g form) - ServiceNow Wiki"



regards harish


Regards
Harish

sharmavikrant
Kilo Expert

Thanks Harish, But the option let to you add an option in a particular index but not help you sort the list.


Thanks again.


ohh..then u have to remove the option add it again..i   din fin any solution fo that.


Regards
Harish

sharmavikrant
Kilo Expert

Thanks Harish, but I am bit afraid I didn't understand remove and add it again. I have applied a script on some variables on a service catalog, which are dependent on each other and present a certain list of options depending on the option selected on the first one. I have been searching and couldn't find any way around how I might be able to sort the list criteria.


I hope that provide more information?