How to create dependent variables in Multi row variable sets

pramodkumar
Tera Expert

Hi All,

we have a requirement to create 3 variables in MVRS, Category, sub category and quantity. When a category is selected, only the sub categories associated to that category should be displayed. How can we achieve this?

 

Thanks! 

1 ACCEPTED SOLUTION

Michael Jones -
Giga Sage

Depending on the number of options and how dynamic you need your options to be, you can script it, or you can use a table driven approach as Sachin suggests and outlines. The one thing that I would add is that, if you want to use a table driven approach without a custom table, you can load your options in the sys_choice table and set the reference on your lookup select box that table. It's more or less made for this type of option / dependent value format. 

For example, I made these sys_choices: 

find_real_file.png

Then two lookup select boxes on my mrvs: (be sure to make note of the variable attributes and reference qualifiers

find_real_file.png

And this is what I get...

find_real_file.png

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

View solution in original post

8 REPLIES 8

sachin_namjoshi
Kilo Patron
Kilo Patron

Use below solution for dependant variables like category, subcategory 

 

https://community.servicenow.com/community?id=community_article&sys_id=ed94c724db75c410feb1a851ca9619bc

 

Regards,

Sachin

Michael Jones -
Giga Sage

Depending on the number of options and how dynamic you need your options to be, you can script it, or you can use a table driven approach as Sachin suggests and outlines. The one thing that I would add is that, if you want to use a table driven approach without a custom table, you can load your options in the sys_choice table and set the reference on your lookup select box that table. It's more or less made for this type of option / dependent value format. 

For example, I made these sys_choices: 

find_real_file.png

Then two lookup select boxes on my mrvs: (be sure to make note of the variable attributes and reference qualifiers

find_real_file.png

And this is what I get...

find_real_file.png

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Hi @Michael Jones - GlideFast Thanks for the response.

Since we are not mapping the variables in MVRS to any of the fields in target table, can we still use the element name without the actual field on table.

 

Thanks!

Yes, in my example I selected the sys_choice table itself as the table for my choices and, even though the element does not exist on that table, you can still use those records in the lookup select box (element is just a string field, not a reference). You just use element so that you can create a reference qualifier that only returns the values you want for your specific field, and use dependent value as a way to tie subcategories to categories by value. 

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!