Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Make visible variable which is outside of var set

FotinaG
Tera Contributor

Hello guys, 

 

I got stuck with the catalog client script. 

I have var set with specific variable 1 which i want to be shown on catalog item.

However visiblity of this variable depends on select box which is in var set 2. 

UI policy in catalog item didnt work, i guess it should be catalog client script.

I create onChange and Variable name is select box from var set 2.

In script I simply wrote if selct box is value mychoice, then field special variable is visible.

It didnt work. Iwonder if i have to create a script in var set 2?

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == 'mychoice') {

    g_form.setVisible('special_variable,true);// I also tried displayValue, didnt work
 
      return;
   }
    }
 
Thank you in advance!
Fotina
1 ACCEPTED SOLUTION

pratikjagtap
Giga Guru
Giga Guru

Hi @FotinaG ,

 

Try below script:

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading) {
        return;
    }

    if (newValue == 'mychoice') {
        g_form.setVisible('special_variable', true);
    } else {
        g_form.setVisible('special_variable', false);
    }
}


If my response helped, please hit the 👍Thumb Icon and accept the solution so that it benefits future readers.

 

Regards,
Pratik

View solution in original post

2 REPLIES 2

pratikjagtap
Giga Guru
Giga Guru

Hi @FotinaG ,

 

Try below script:

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading) {
        return;
    }

    if (newValue == 'mychoice') {
        g_form.setVisible('special_variable', true);
    } else {
        g_form.setVisible('special_variable', false);
    }
}


If my response helped, please hit the 👍Thumb Icon and accept the solution so that it benefits future readers.

 

Regards,
Pratik

Thank kyou so much! it worked!