Variable reference field based on another variable answer

KLee19
Tera Contributor

Hi Folks, I have found a lot of similar questions online but none which have enabled me to return the right result.

I have a catalog item variable that has a select box with 7 answers.  Name is bypass_var
I have another variable which is a location reference field. 
Essentially I need a location removed from the location variable if the bypass_var selection contains the word global. 

 

For example 2 of the 7 results are Pending global approval and Global documentation approved.

I have tried using  different variations based on different docs but here is an example of one(will add the second qualifier when this first is working):
ref_qual_elements=bypass_var in the attributes

and a ref qualifier of javascript: current.variables.bypass_var+'=Pending global approval^name!=Darwin'


Any ideas?

 

2 REPLIES 2

Slava Savitsky
Giga Sage

Try this:

javascript: var refQual = ''; if (current.variables.bypass_var == 'Pending global approval' || current.variables.bypass_var == 'Global documentation approved') refQual = 'name!=Darwin'; refQual;

Dnyaneshwaree
Mega Sage

Hello @KLee19,

You can refer the below catalog Client script (Onchange var = checkbox)and update it according to your requirement:

 

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading || newValue == '') {
		return;
	}
 var grCheck = g_form.getValue('bypass_var');   // add your checkbox variable name
 var grLoc = g_form.getValue('location_var');          // add your location variable name
			if (grCheck == 'global1....' || grCheck == 'global2....'){  // add choices names of checkbox variable that contains "global".
                       g_form.clearValue('grLoc');
	}
}

 

 

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru