The CreatorCon Call for Content is officially open! Get started here.

Hide a single variable in a variable set

Teri Bobst
Mega Guru

I have a variable set: Contact Info that is applied to every item in my service catalog. I have a variable within this set called Ship_to. I only want Ship_to to be visible and mandatory if the items billable(sc_cat_item_billable) flag is true.

I have tried multiple client scripts and UI policies but have not gotten any to work yet. Has anyone been able to accomplish this before?

Thanks,

Teri

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

This may sound a little odd, but it works.   I'm assuming here that "Ship_to" is visible and mandatory by default.



1. Create a new Variable Set called "Hide Ship To" (or whatever)


2. Create a new "onLoad" Client Script with the following settings:



Applies to:             Variable Set


Variable set:       Hide Ship To


Applies on a Catalog Item view:         checked


Applies on Requested Items:                   checked


Applies on Catalog Tasks:                               checked


Script:


function onLoad() {


      try{


                  g_form.setMandatory("variables.Ship_to", false);


                  g_form.setDisplay("variables.Ship_to", false);


      } catch(err) {}


}



Add the new Variable Set to each Catalog Item where you want the field hidden.   No actual Variables are required in the Variable Set.  


View solution in original post

5 REPLIES 5

You are welcome!