Filter a subcategory field from category field in Catalog item

dioni95
Kilo Expert

Hi all,

I have two reference fields in a catalog item (Category, subcategory). Both based on sys_choice table and they are the choices of the category and subcategory fields of the incidents table.

I need to filter the subcategory based on his dependent value field to link to the category field, like the categories and subcategories in the incident module.

Note: I've been trying with  Reference Qualifier

Any help will be appreciated.

Thanks in advance

9 REPLIES 9

sachin_namjoshi
Mega Patron

You need to use advanced reference qualifier with script include for subcategory field.

Please check below

 

https://www.servicenowguru.com/scripting/script-includes-scripting/advanced-reference-qualifier-script-include/

 

Regards,

Sachin

harshav
Tera Guru

Also you need to write an Onchange client script along with the reference qualifier.

Thanks

ccajohnson
Kilo Sage

Since you indicated you are using reference fields, you should be able to make the following changes to your variables:
Category variable:
Reference qualifier: name=incident^element=category^inactive=false^ORDERBYsequence

Subcategory variable:
Reference qualifier: javascript:'name=incident^element=subcategory^inactive=false^dependent_value=' + current.variables.category + '^ORDERBYsequence';
Variable attributes: ref_qual_elements=category

I am guessing that your category variable name is category. If it is something different, change the ref_qual_elements accordingly.

Hi,

Thanks for your reply.

 

I used both reference qualifiers that you bring me, but when I search the subcategory it doesn´t find records.

 

Note: I replaced category with the name of my variable in the subcatecory's reference qualifier and variable attributes 

Thanks again.