- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2023 12:56 PM
Hi
I am trying to hide/remove some of the categories and some of the subcategories from the Report an Issue RP on Service Portal view.
I have used on load catalog client script to hide some categories as follows and it worked
g_form.removeOption('category', 'Linux', 'Linux'); g_form.removeOption('category', 'Oracle', 'Oracle'); g_form.removeOption('category', 'Schedule Tasks', 'Schedule Tasks'); g_form.removeOption('category', 'Solaris', 'Solaris'); g_form.removeOption('category', 'vmware', 'vmware'); g_form.removeOption('category', 'User Email', 'User Email');
similarly I have tried both on load and on change to hide/remove some categories under Network Catalog but not working ( I know it is due to dependent value but how to overcome it)
var category = g_form.getValue('category'); if (category == 'network'){ g_form.removeOption('subcategory', 'WAN', 'WAN'); g_form.removeOption('subcategory', 'LAN', 'LAN'); g_form.removeOption('subcategory', 'IP Address', 'IP Address'); }
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 05:15 AM
Hi Amit,
Created a script include with the filter of choices we need and added this to Subcategory Reference Qualifier.
Now its working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2023 12:59 PM - edited 06-14-2023 01:00 PM
Your best bet would be to inactivate the choices on the variables on the record producer.
find the category and subcategory fields, then set the choices inactive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2023 01:02 PM
but I want them for the Native UI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2023 09:45 PM
HI @Rahul Raja Sami ,
I trust you are doing great.
To overcome this issue, you can use an onChange client script instead of an onLoad client script. This will allow you to dynamically update the subcategory options based on the selected category.
Here's an example of how you can achieve this:
// Define the onChange client script for the 'category' field
function onChangeCategory() {
var category = g_form.getValue('category');
// Check if the selected category is 'network'
if (category === 'network') {
// Remove the unwanted subcategories
g_form.removeOption('subcategory', 'WAN', 'WAN');
g_form.removeOption('subcategory', 'LAN', 'LAN');
g_form.removeOption('subcategory', 'IP Address', 'IP Address');
}
}
// Register the onChange client script on the 'category' field
g_form.addOnChange('category', onChangeCategory);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2023 02:46 AM - edited 06-15-2023 02:56 AM
Hi Amit
I have tried onchange() as well and I have replicated the whole script and checked but it shows no difference.