How to hide a choice from showing in a dropdown?

astanley
Tera Contributor

I have a select box variable that is part of a variable set. This variable set is included in multiple catalog items, but I want to exclude one choice on the select box variable from showing only on one catalog item. Is there a way I can do this without scripting? I tried to create a UI Policy so that, that region (the choice I am trying to exclude) cannot be selected/is not visible, but I am unsure how to do this. Please advise! 

1 ACCEPTED SOLUTION

Hi @adrienne 

Couple of things you need to correct in your Script. Based on your screenshot, I have highlighted what changes you need to do by writing my comments in the image below:

find_real_file.png

If you ae not sure on what will be the value for choice then follow the steps below:

1) Open your catalog item on which this Variable is present.

2) After opening it, click on Variable Set Related List as shown below:

find_real_file.png

3) Now in this Variable Set open the Variable under Variable Related List which has the choice option as for example shown below:

find_real_file.png

Now open this variable record and here you can find the variable Name highlighted in red below and also the choice value which you need to use:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

6 REPLIES 6

Saurav11
Kilo Patron
Kilo Patron

Hello,

Write a onload client script:-

var item=g_form.getUniqueValue();

if(item=='sysidofthecatalofitemforwhichyouwanttoremove')

{

g_form.removeOption('fieldname','chioiceoptionvalue');

}

Please mark answer correct/helpful based on Impact.

shloke04
Kilo Patron

Hi,

You do not need to hard code a Sys id of the catalog item here.

Solution Proposed:

1) Write a Catalog client script on your catalog item itself and use the script below: With this solution your other item will not be affected and this change will be only for this particular item.

You will need a script here and UI Policy will not work in this scenario.

function onLoad() {
   //Type appropriate comment here, and begin script below
   g_form.removeOption('VariableName','choiceValue'); // Replace your field Name here and also choice value which you want to remove.
}

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hello shloke, I am unsure of what exactly I am putting in the "variable name" section and the "choice value" section. Am I putting the sysid here or simply putting the name?

shloke04
Kilo Patron

Hi @adrienne 

Just make sure you are writing a Catalog Client Script and not a Client Script here. Also if in case you want to make this work when item is submitted just check the different check boxes which is available in Catalog client script shown below:
Highlighted in Red if you want this script to work after form submission in native view as well:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke