Hide Options from Select Box

jessicaa_perry
Kilo Contributor

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.

15 REPLIES 15

Akhil Vinay Ma1
Kilo Guru

Hi,

use g_form.clearOptions() method. It is going to delete all options and the use g_form.addOption()method in client script.

 

 

Anurag Tripathi
Mega Patron
Mega Patron

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??

 

-Anurag

Matthew Smith
Kilo Sage

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

jessicaa_perry
Kilo Contributor

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.