How to hide mandatory variable

krishna87654
Kilo Expert

How to hide mandatory variable in catalog item. This variable is mandatory in variable set

1 ACCEPTED SOLUTION

krishna87654
Kilo Expert

It is working with UI Policy with condition Mandatory, visible, read only to false.


View solution in original post

20 REPLIES 20

Ankush Jangle1
Kilo Guru

Hello,

 

You can use catalog client script

Applies to:             Variable Set

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) {}

 

}

 

 

Please Mark it as helpful/Correct if it help you

 

I tried the below onload script but not working

function onLoad() {
try{
g_form.setMandatory('u_environment_catalog', false);
g_form.setDisplay('u_environment_catalog', false);
}

catch(err){}


}

Willem
Giga Sage
Giga Sage

You cannot hide a mandatory variable.

In your client script, first set it to not be mandatory and then hide.

Create an onLoad Catalog client script like this:

replace <variable name> with your variable name.

function onLoad(control, oldValue, newValue, isLoading) {
    g_form.setMandatory("<variable name>", false);
    g_form.setDisplay("<variable name>", false);
}

I tried the below script but not working

function onLoad() {
try{
g_form.setMandatory('u_environment_catalog', false);
g_form.setDisplay('u_environment_catalog', false);
}

catch(err){}


}

Use this:

function onLoad(control, oldValue, newValue, isLoading) {
    g_form.setMandatory("u_environment_catalog", false);
    g_form.setVisible("u_environment_catalog", false);
}