- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 07:54 PM
Hi: I want to be able to hide some Choice entries but not remove them, so that they can be updated by business rules but prevent the user from selecting them. Is there a way to do this? I know you can use g_form.removeOption(<field>, <choice>). I guess I am looking for a g_form.hideOption(<field>, <choice>), but that doesn't work.
Thanks for your help!
Rita
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2016 07:23 AM
Sure Rita.
Just to give you another option-
"g_form.removeOption(<field>, <choice>) did not work for me because when I set the removed choice using the business rule, the removed choice did not appear on the form."
To show the removed choice when it is set by business rule you can add condition to the onLoad client script/UI action(containing removeOption()) to check if the current choice is not the one to be removed and if it not then remove the option.
For e.g. lets say you don't want to allow the users to select state1.
Then you can add condition - State is not state1 - and in script 'g_form.removeOption('state','state1');'.
This will remove the option only if it is not currently set on the record. If its set then it will be displayed else it will be removed. If you again set it to any other state again it will be removed.
--Mark correct/helpful if it helps solving your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2016 07:40 AM
Hi Tanaji: I like your suggestion. That will work for me too!
Thanks, Rita

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:28 AM
Thank you Tanaji 🙂 It worked....!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2023 09:00 AM
I know this is a super old post, but I was looking for a solution to hide options without removing them.
Didn't find anything so I created my own. This solution is simple and allows you to hide choice elements but still allowing them to be set as proper values with displayValues by server-side scripts.
So this client script sets the options to be hidden but still usable by server side scripts.
function onLoad() {
var options= Array.from(g_form.getControl('YOUR_FIELD_NAME')); //Set your target field
var hiddenOptions = ['option_1', 'option_2']; //Add your choice values to hide here.
options.forEach(function(e){
if(hiddenOptions.indexOf(e.value) > -1)
e.hidden = true;
});
}
Example:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 12:49 PM
This worked beautifully. Straight forward and easy to implement. Thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2024 04:19 AM
Hi I have similar requirement
i want to hide "on hold" choice in state field in incident form based on the "Platform" field entries so i want to hide "on hold" choice when the platform team is uv , hcl and av team . so for these teams on hold choice should be hidden in state field
can you suggest me on how to achieve this