How to hide an option from a multiple choice variable in catalog item

Rebecca_J
Tera Contributor

I need to hide an option from a Multiple Choice variable based on another variable's value.

I knowg_form.removeOption does not work for Multiple Choice field, and I cannot change the field type to Select Box as we have many scripts associated with the field.

Any suggestions?

Thank you.

 

1 ACCEPTED SOLUTION

Prins Kumar Gup
Giga Guru

Hi,

 

You cannot use g_form.removeOption for a multiple-choice type of variable(radio button).

You have below options :

1) Use select box(dropdown) instead of multiple choice variable

 

2) Create two different radio button variables with the same name in which one has all options, and the other radio button has only a few options(don't include options you need to hide)

Then write an on-change client script to show the first or second variable based on selection.

 

3) You can write a global UI script and use it in the client script to disable the option instead of hiding it.

http://www.servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-opti... has that script

 

 

Mark as correct or helpful as applies

Regards,

PKG

View solution in original post

2 REPLIES 2

Prins Kumar Gup
Giga Guru

Hi,

 

You cannot use g_form.removeOption for a multiple-choice type of variable(radio button).

You have below options :

1) Use select box(dropdown) instead of multiple choice variable

 

2) Create two different radio button variables with the same name in which one has all options, and the other radio button has only a few options(don't include options you need to hide)

Then write an on-change client script to show the first or second variable based on selection.

 

3) You can write a global UI script and use it in the client script to disable the option instead of hiding it.

http://www.servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-opti... has that script

 

 

Mark as correct or helpful as applies

Regards,

PKG

This solution is not correct until you correct the bad ServiceNow Guru link.