How to access variable set values from another variable set

Mohammad1
Tera Contributor

Hello,

I have record producer with 2 variable sets. I need to decide whether to show the second variable set based on the value that is entered in the first variable set. I assume that a UI Policy or a client script should solve this issue, however, it seems that accessing variables from another variable set is not a straight-forward task. Please let me know if you have tried something like this before.

Note: Both variable sets are multi-row variable set.

Thanks,

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

Use the onSubmit client script on catalog item level. 

 

Limitation MRVs

 

Note:

  • Catalog UI policies and catalog client scripts defined at the item level are not applicable for variables in a multi-row variable set. Only those catalog UI policies and catalog client scripts defined within the multi-row variable set are applicable for variables in the multi-row variable set.

 

https://docs.servicenow.com/bundle/orlando-it-service-management/page/product/service-catalog-manage...

View solution in original post

23 REPLIES 23

try now, added alert as well , so validate, what are you getting in alert. 

 

function onSubmit() {
	var value = g_form.getValue("my_variable");

alert(value);
	
	if (value == "A") {
		alert("value is A");
		g_form.setDisplay("vs2", true);
	}	
}

Hi Harshvardhan, The value is retrieved correctly from my_variable. I already checked that.

the first alert is A the second alert also works.

 

Note: Obviously it is not an issue of whether it goes inside the if statement or not. It is an issue of whether the second variable set is accessible from here or not.

if second variable sets variable is on your form then you will able to set it. 

Unfortunately I'm not. Did you try it and it worked?

can you add screenshot of your form?

make sure the other variable which you are trying to hide is not mandatory