How to populate sub categories based on categories in catalog item variables

sinu2
Tera Expert

Hi All,

 

I have created a catalog item, in that i have created two reference fields 1. category 2. subcategory. But when i select category all subcategories are showing irrespective of category . i want to show only related subcategories with respect to category . How can i achieve this?

 

find_real_file.png

3 REPLIES 3

Community Alums
Not applicable

Hi,

 

As both the fields are reference fields you can do the same using reference qualifiers. Use this post as a reference:

https://community.servicenow.com/community?id=community_question&sys_id=61f307e5dbd8dbc01dcaf3231f96...

 

Or you can wrte an OnChange Client Script for the Category field:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}

if(NewValue == 'value')

g_form.setValue('subcategory','value');

.....//insert required conditions

}

 

Please mark as correct/helpful if this helps! 🙂

Thanks,

DR

SatheeshKumar
Kilo Sage

if both your category and sub category are in same table use the reference qualifier to get this done

 

for more deatils check the below link.

 

https://community.servicenow.com/community?id=community_question&sys_id=b22643a1db1cdbc01dcaf3231f96...

 

-satheesh

 

 

Rahul Kumar17
Tera Guru

hi

u can write own table name 

find_real_file.png

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar