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

How is that a solution, and why was it marked as one?  This is why we cannot have nice things.

Asked them if it was cool and then just switched it to a select box. Thanks for your help Khushboo!

SaiRaviKiran Ak
Giga Guru

Hi,

 

Try below code :

find_real_file.png

Mark Correct if it solves your issue.

 

Thanks,

Ravi

Hi Ravi,

Negative on adding the "else" to the end. Any other suggestions?

richelle_pivec
Mega Guru

I'm just curious. Why do you need to keep the option if you aren't going to display it? Not that it's any of my business, but I'm just trying to think of a reason.

thanks, Richelle