Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Catalog Item to show subcategory based on categories without dependent value.

SD_Akshay
Giga Guru

I have created Variable choices for Category and Sub- categories in specific variable. Normally when we create choices it gets created on Choice table. But here dependent value option is not the case.

 

How can I populate Sub categories based on Categories when I don't have dependent value. 

 

1. I have tried client script and it is working fine as expected. But my sub-category choices are more than 150+. So the client script have became more than of 900+ lines.

(Method used in client script addOption/removeOption)

2. We can't use reference qualifier since the choices aren't on Choice table and don't have dependent value.

3. No requirement to create Custom table. 

 

Please give solution  

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Akshay Kamble (SD_Akshay)
ServiceNow Developer
LinkedIn: https://www.linkedin.com/in/akshay-kamble-1504/
****************************************************************************************************************
2 REPLIES 2

SD_Akshay
Giga Guru

I was able to achieve this using maintain item catalog variables itself, I created the variables in sys_choice table itself and fetched them from variable by giving it type as "Lookup Select Box" and in "Type Selection" related section had the below configurations

 

Lookup from table : Choice
Lookup value field : Value
Lookup value field(s): label
Reference qualifier: javascript:'name=incident^element=subcategory^dependent_value=' + current.variables.category;
 
And if the third field is there which is dependent on sub-category I would add in Type Specification section
 
Variable attributes : ref_qual_elements=subcategory
 
With this I did not had to add any custom table or any choices in maintain item variable. 
 
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Akshay Kamble (SD_Akshay)
ServiceNow Developer
LinkedIn: https://www.linkedin.com/in/akshay-kamble-1504/

****************************************************************************************************************
 
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Akshay Kamble (SD_Akshay)
ServiceNow Developer
LinkedIn: https://www.linkedin.com/in/akshay-kamble-1504/
****************************************************************************************************************