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.

Restrict category and subcategories depending on Catalog Item

kaustubh vishnu
Tera Expert

Hi,

For Incident managing, I have 10 categories and respective subcategories.
For Catalog Items(Record Producer to "Raise an Incident") I am using same values of category and subcategory.
But for another Catalog Item(Record Producer to "Raise Security Incident") I want to show only 5 categories and respective subcategories.

I want to restrict values of categories for specific Catalog Item.
I think need to use "catalog client script" but  don't know to how and what should be script.

Please help me to restrict values of categories for specific Catalog Item.

1 ACCEPTED SOLUTION

kaustubh vishnu
Tera Expert

Answer:
Use following code as per requirement:

//g_form.addOption('variable_name''choice value''choice lable');

g_form.clearOptions('category') // is important to clear available set of categories


g_form.addOption('category', 'hardware', 'Hardware'); // to add category option


g_form.removeOption('category', 'Login Issue', 'Login Issue');  // to remove category option

Thanks

-KV

View solution in original post

6 REPLIES 6

Thank you for the response.

I got the solution that I can use following code for my requirement.
g_form.clearOptions('category')
g_form.addOption('category', 'hardware', 'Hardware');
g_form.removeOption('category', 'Login Issue');

kaustubh vishnu
Tera Expert

Answer:
Use following code as per requirement:

//g_form.addOption('variable_name''choice value''choice lable');

g_form.clearOptions('category') // is important to clear available set of categories


g_form.addOption('category', 'hardware', 'Hardware'); // to add category option


g_form.removeOption('category', 'Login Issue', 'Login Issue');  // to remove category option

Thanks

-KV