Auto populate short description based off category and subcategory

Community Alums
Not applicable

Hi Community,

I have requirement to auto populate the short description based off category and sub-category (service catalog). Based on category i'm populating sub-category using on change client script. Here the requirement is based on category and sub-category values i need to populate the short description value. I have 10 category and almost 20 sub-category and each sub-category has more the 25 short description. If i hard code the code like add option and remove option the code is near to 5k length.

Can some one help me how to achieve this.

 

Thanks in advance

Rafmine

 

 

 

5 REPLIES 5

Shubham Bongulw
Giga Guru

Hi Rafmine,

Please refer the link below as it has kind of similar requirement as yours-

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

 

Warm Regards,

Shubham Bongulwar

Please mark helpful or correct if it helps!!!

 

Ivano B
ServiceNow Employee
ServiceNow Employee

Hi Rafmine

if the short description must be set as category + sub_category than the other reply works..but in case you have a list of descriptions and you need to pick one specific according to category and sub category then I'm sorry to say that hardcoding is not the right option.

Not sure the situation with custom tables within your organisation/contract but this sounds achievable with a custom table where you can store all the short descriptions.

Of course, the new table must keep category (ref to sys_choice) subcategory (ref to sys_choice and dependent to category) and short description and used as matrix to get the right short-description.

 

If you have the table, you can use onChange code - unfortunately - async Ajax to retrieve the right description.

This will reduce the amount of code but will include the maintenance of the new table where you have the short descriptions handled

Cheers

R0b0

Community Alums
Not applicable

Hi Robo,

Thank you for showing interest in answering my post.

we don't have permission to create custom table. the three variable are select box type and the values is stored in question_choice table. 

can you help me with the async ajax code to complete my task.

 

Thanks,

Rafmine.

 

Hi Rafmine

if you are working on another sys_choice then you don't need to write any code.

Try making the short description field dependent to the actual sub category field that you have..something like this on your dictionary.

find_real_file.png 

Then You can work on the dependent field column available on sys_choice table to match the actual value of sub category you want

find_real_file.png

 

This should work..of course the user is in charge to pick from the drop down list.

Cheers

R0b0