- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 04:11 PM
Hi all,
We have created a view (XYZ) and want to hide OOTB options of category field on Incident form. Basically, we have created a view for the set of people who should use thier own incident form and shouldn't have access to OOTB process. I have hide category and subcategory options from these users.
I have created a view rule as well.
Thanks,
Su
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 06:46 PM
Hi @Su Tyagi ,
In an onLoad client script, uncheck the global checkbox and then enter the view you want the client script to apply to.
Then you can use the removeOption method on g_form to remove the options that shouldn't be visible.
g_form.removeOption('category', '1');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 06:45 PM
Hi @Su Tyagi ,
You can clear all options
Create an onLoad client script
function onLoad() {
// Replace 'XYZ' with the actual name of your view if it's different.
if (g_form.getViewName() == 'XYZ') {
// Clear all options from the 'category' field
g_form.clearOptions('category');
// Example of how to add a specific option back if needed:
// g_form.addOption('category', 'your_value', 'Your Display Label');
// Clear all options from the 'subcategory' field
g_form.clearOptions('subcategory');
// Example of how to add a specific option back if needed:
// g_form.addOption('subcategory', 'your_value', 'Your Display Label');
}
}
Or you can hide those fields entirely instead of hiding all options
function onLoad() {
// Replace 'XYZ' with the actual name of your view if it's different.
if (g_form.getViewName() == 'XYZ') {
// Hide the 'category' field
g_form.setDisplay('category', false);
// Hide the 'subcategory' field
g_form.setDisplay('subcategory', false);
}
}
Regards
Chaitanya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 06:46 PM
Hi @Su Tyagi ,
In an onLoad client script, uncheck the global checkbox and then enter the view you want the client script to apply to.
Then you can use the removeOption method on g_form to remove the options that shouldn't be visible.
g_form.removeOption('category', '1');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2025 09:52 AM
Thanks Brad!
Worked like a charm..
Su
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 07:45 PM
you can use g_form.removeOption(), g_form.addOption() and manipulate the options of category field.
what did you start with and where are you stuck?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader