How to hide/disable one multi row variable set(MRVS) based on condition of another Multi Row Variable Set(MRVS) on Record Producer

Raviteja Kunal1
Tera Expert

Hi All

Need help on Multi Row Variable Set client side scripting on an Record Producer. I have 2 MRVS.

Based on first MRVS entry another needs to be disabled or hidden.

Any suggestions how to achieve or reference is highly appreciated.

Thank You 

 

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

You need to write an onChange Catalog Client Script within the 1st MRVS, when your particular variable in the variable set changes. So for any row in MRVS1, when a certain value is selected, MRVS2 will become hidden.  The script would look like this to hide the 2nd MRVS.

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

	if(newValue == 'My Choice'){//replace with the value that should hide MRVS2
		if(this){//Service Portal method
			this.cat_g_form.setDisplay('mrvs2', false);//replace with the internal name of 2nd MRVS
			
		}
		else{//native UI method
			parent.g_form.setDisplay('mrvs2', false);//replace with the internal name of 2nd MRVS
		}
	}
}

If you are using Service Portal, you will also need an onLoad Catalog Client Script within the Record Producer, not the MRVS.

function onLoad() {
	if (this) {//we only need to do this for Service Portal
		//We need to make the g_form object for the parent item available from the MRVS window
		this.cat_g_form = g_form;
	}
}

View solution in original post

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you cannot write onChange client script on the entire MRVS Variable set.

you can create onChange on variables within MRVS

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Raviteja Kunal1
Tera Expert

Hi Ankur

Thank you Ankur, can we hide entire MRVS based on a dropdown field selection?

Hi,

based on 1 variable of 1st MRVS yes you can hide/show the 2nd MRVS

g_form.setDisplay('2ndMRVSVariableName', false);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

If i want to hide one field based on value of another field in same mrvs...then what to do?