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.

Sorting List Collector variable values

Erica2
Tera Contributor

Hello,

We have a software list collector that contains 'Other'.  The list currently sort by alphabetical order.  Is it possible to move the 'Other' value to the bottom of the list?  Thank you

 

Erica2_0-1698333205994.png

 

8 REPLIES 8

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Cant think if a straightforward way to do it. 

 

What I would do is remove other altogether and have a checkbox which says 'Cant find the software you need', as soon as the user checks it I would populate this question (in your screenshot) with 'Other'

-Anurag

Thank you @Anurag Tripathi  for your great suggestion.  I had previously considered this option and offered it to the users, but they preferred to have the 'Other' value displayed in the list collection. This is why I am seeking assistance from the community.

Try this, it might work

 

In an onload client script 

 

if(g_form.getValue('<variable name>') != '')
{
g_form.removeOption('<variable name>','<value of other>');
g_form.addOption('<variable name>','<value of other>','Other');
}

 

 When it a new choice is added it usually goes at the end of the list.

-Anurag

@Anurag Tripathi 

Is the following code looks right.  If it does, then that did not work.

if(g_form.getValue('software_name') != '')
{
g_form.removeOption('software_name','Other');
g_form.addOption('software_name','Other','Other');
}