Dependent variable on Catalog item

Nithin21
Tera Expert

I have 2 variables on Catalog item

Category

Sub-Category

 

Category:

Type = "Select Box" , choice table = "cmdb_ci_appl", choice field = "Category"

Sub-Category:

Type = "Select Box" , choice table = "cmdb_ci_appl", choice field = "SubCategory"

 

In table cmdb_ci_appl, SubCategory is dependant on Category. 

Similarly, in Catalog item, how to make SubCategory variable dependant on Category variable?

1 ACCEPTED SOLUTION

ccajohnson
Kilo Sage

For this solution, you can change your variables to be Lookup Select Box types instead of Select Box. This way we can set the attributes on those variables to look up from the cmdb_ci_appl table. For this example, the names of the variables are category and subcategory respectfully. Here are the changes you need to make to your variables:

Category [category]
Type: Lookup Select Box
Lookup from table: Application [cmdb_ci_appl]
Lookup value field: Category
Lookup label field(s):
Include none: true
Unique values only: true
Reference qualifier:
Subcategory [subcategory]
Type: Lookup Select Box
Lookup from table: Application [cmdb_ci_appl]
Lookup value field: Category
Lookup label field(s):
Include none: true
Reference qualifier: javascript: 'category=' + current.variables.category;
Variable attributes: ref_qual_elements=category

View solution in original post

10 REPLIES 10

It works also for "List collector", great 🙂

I see a minor typo. For subcategory field, lookup value field should be subcategory.

 

Category [category]
Type: Lookup Select Box
Lookup from table: Application [cmdb_ci_appl]
Lookup value field: Category
Lookup label field(s):
Include none: true
Unique values only: true
Reference qualifier:
Subcategory [subcategory]
Type: Lookup Select Box
Lookup from table: Application [cmdb_ci_appl]
Lookup value field: Subcategory
Lookup label field(s):
Include none: true
Reference qualifier: javascript: 'category=' + current.variables.category;
Variable attributes: ref_qual_elements=category

Hi, where in your answer to do refer to subcategory?

 

Thanks.  FRED

Snehal2
Kilo Guru

Here is the blog post I have written that can help you. Dependent catalog variables can be created in two ways. 

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

Hit Like if this helps you!

Regards,

Snehal

Kailash Bhange
Kilo Sage
Kilo Sage

Hi All,

Please take a look at Article below:

1. dependent on single table
2. dependent on two tables using referene

[SOLVED]: - Dependent variable on Catalog item using Lookup Select Box
https://community.servicenow.com/community?id=community_article&sys_id=1ce7dceedb5914101cd8a345ca961952

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

Thank you!
Regards,
Kailash.