Hide Options from Select Box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2018 07:34 AM
For the Create Incident form, I added Category as an option. I was able to add this option and it inserts into the Incident table. Success!
However, I only want a few categories available for our users to choose from in this form. We'll call these internal vs. external categories. How do I hide the internal categories?
After some research, I'm trying to use the onLoad function with the g_form.removeOption, but I can't seem to get it to work. This is my first time working with client scripts.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2018 07:40 AM
Hi,
use g_form.clearOptions() method. It is going to delete all options and the use g_form.addOption()method in client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2018 07:44 AM
Hi Jessica,
g_form.removeOption should ideally work. Can you show the script for us to see how are you using it??
Also are you working on portal or native SN ui??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2018 07:45 AM
Hi Jessica
Has the Category option been added as a Lookup select box or a Reference field? If so, could you try using the condition builder and refine which of the Categories are displayed there?
Hope it helps.
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2018 07:59 AM
Here's the script I've tried to write through researching the community boards and reading about GlideForm for Jakarta:
function onLoad() {
if (g_user.hasRole('itil_admin'))
return;
if (g_form.getValue ('Category') != 'backuptapes')
g_form.removeOption('Category', backuptapes);
}
The Category option is set as a Select Box, which pulls in all the new categories I've created in the Incident table.