How to set Category and sub category automatically for record producers without hardcoding or creating templates

anithanarayan
Mega Guru

Hi All,

We are creating a lot of record producers more than 300(for creating incidents) without including the category and sub category options. We don't want to let user to select category and sub category. Instead give search ability to return a simple form asking short description and description.

To create incident in the right category and sub category based on the record producer, in the backend either we can use templates or scripting.

If we use templates we will end up creating 1 template for each record producer (300 templates for 300 record producers)

If use script option, I will need to create a reusable script, where the category and sub category gets changed but is hardcoded. Something like below. But hardcoding is not a good coding practice.

current.category = 'Hardware';
current.subcategory = 'Server';

Does anyone have a better alternate, without hardcoding and using templates ?

Thanks in Advance.

Regards,

Anitha

 

 

1 ACCEPTED SOLUTION

Hi,

Then in that case couple of approahces

1) create a custom table to hold mapping of each category and subcategory and the record producer so that you would know what cat and subcat to be populated based on RP

2) create system property of type string which would hold json structure and then you can parse the json and get the cat and subcat value for RP

note: for custom table there will be cost involved based on your subscription

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

refer these links and they should help you configure the same for record producer or catalog item

Using Category and Subcategory on record producers

ServiceNow - Dependent Variables on Record Producer in Service Catalog

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

anithanarayan
Mega Guru

@Ankur Bawiskar Thank you for the response.

Actually I do not want to show the category and sub category to be visible on portal.

Instead set it from backend for each record producer depending on the record producer, which would be different combination of category and sub category.

Hi,

Then in that case couple of approahces

1) create a custom table to hold mapping of each category and subcategory and the record producer so that you would know what cat and subcat to be populated based on RP

2) create system property of type string which would hold json structure and then you can parse the json and get the cat and subcat value for RP

note: for custom table there will be cost involved based on your subscription

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

Thanks for so much.

I tried both the options and both the options are working.

Thanks,

Anitha