Remove option from a Multiple Choice variable without deleting it.

mattystern
Kilo Sage

Hello,

I have been tasked with hiding an option in a multiple choice list. I found there was not an "Active" button to work with, so I started writing a catalog client script to do this. However, I am having difficulty getting this script to work. 

For purposes of an example (and because I was going insane trying to get it to work on Friday), I went ahead and created a new catalog with a variable called "Choice Testing," a multiple choice list with options "Red", "Green", and "Blue"

find_real_file.png

Next, I created a catalog client script in order to remove the "Red" variable. According to this post, it is wise when using an "onLoad" client script to verify that the option is not selected by default in your script which is why the "If" statement exists. 

find_real_file.png

Alas, after the script our friend "Red" still loads on the form.

find_real_file.png

I tried implementing the function "Disable Option" into my System UI -> UI Scripts in accordance with the post I referenced earlier. Unfortunately, this did not also work to hide the variable. 

Can I get some pointers on how to make this work? Hopefully it is just some silly mistake on my part. Any help is appreciated! 

 

1 ACCEPTED SOLUTION

I believe removeOption() doesn't work for removing options from Multiple Choice type of variable. You can use it in Select Box type of variable.

View solution in original post

17 REPLIES 17

Khushboo Kanouj
Mega Expert

Your Script is correct, Select the UI Type to 'All' and it will work as expected. 🙂

Negative on this working Khushboo

find_real_file.png

(And then I hit "Update" and re-loaded my service portal)

find_real_file.png

Can you think of anything else?

I believe removeOption() doesn't work for removing options from Multiple Choice type of variable. You can use it in Select Box type of variable.

Ahh well the exact same script did work on a Select Box! 

Unfortunately, the requirements of this require it to be a multiple choice list 😞

Do you know of an alternate method then maybe?