Remove/Add Options in a List Field

alexpullos
ServiceNow Employee
ServiceNow Employee

I have a List field on a desktop form, not a catalog form. I’d like the selectable options in the List field to be dependent upon the selection made in a Choice List.

 

For example, if the user selects Category One from the Choice List, I’d like to populate the List field with the several subcategories that fall under Category One. A List field is required because the user may want to make multiple selections.

 

Incidentally, g_form.removeOption() does not work with List fields.

 

I’m happy to add or remove options, either way.

 

Any suggestions on how best to achieve this?

1 REPLY 1

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

In this case when the category field changes, you need to clear all values selected in the list field

g_form.clearValue('<field name>'); //this works on list field

-Anurag