Hiding an option on a multiple choice field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2015 11:03 AM
I am trying to hide one of the options on a multiple choice field, on record producer, dependent on who opens the form. I have tried using a catalog client script as well as scripting with UI policies with no luck. I have been using g_form.removeOption, g_form.setVisible, and g_form.addOption in my attempts to hide the option. My first question would be, is this even possible based upon who is opening the form? If so, what is the best way about scripting it, client or UI policy? And lastly, what scripts would I use to hide the value? Thanks for your help. Any suggestions would be helpful.
Thanks,
Mike
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2015 11:13 AM
Hi Michael,
You can use the "g_form.clearOptions()" to remove the option based on the condition.
http://wiki.servicenow.com/index.php?title=Adding_Dependent_Variables
http://wiki.servicenow.com/index.php?title=GlideForm_%28g_form%29
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2015 03:00 PM
Thanks for articles. If I am understanding the articles correctly, that is on the record that is generated. I am looking to have the option to hide options onLoad for the catalog item, not the record. I am still not having any luck with any scripts. Maybe this will help to clarify a solution. Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2015 07:38 AM
It seems that Multiple Choice Types (that display as radio buttons)...which is preferrable in my opinion so that all options are visible at one time without clicking a drop down, do NOT work like the drop-down types. addOption, clearOptions & removeOptions do not work either. Very frustrating...I have to change the look of my form to use Lookup Select Box. This is also bad because the size of the box is not big enough to see a long label and include the price. If anyone knows differently, it would be good to know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2015 07:15 AM
Since each choice is unique you can hide them by using the document.getElementById in a onLoad catalog clients script. Just use your web inspector to find the right ID.
function onLoad() {
var choice = document.getElementById("IO:d45945c44ca80200e1ab8d2ced62c199").parentNode.parentNode;
if (choice){
choice.style.visibility="hidden";
choice.style.display="none";
}
}