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

I'm sorry. I couldn't understand your answer. It gets inside the if-statement but the problem is that it doesn't hide the field.

Hi,

few things to check; I believe you can have that as onChange client script instead of onSubmit; but that is fine; just check what value comes for that variable in alert

var value = g_form.getValue("my_variable");

alert('Variable value is: ' + value);

if (value.toString() == "A") {

}

Regards

Ankur

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

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

I also tried making it run onChange and tweaked the code accordingly. I also tried making the client script run on the catalog item level. I also tried UI Policy. I ended up posting this question only after trying all the obvious solutions.

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.

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...