- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 01:11 AM
I need to hide an option from a Multiple Choice variable based on another variable's value.
I knowg_form.removeOption does not work for Multiple Choice field, and I cannot change the field type to Select Box as we have many scripts associated with the field.
Any suggestions?
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 01:24 AM
Hi,
You cannot use g_form.removeOption for a multiple-choice type of variable(radio button).
You have below options :
1) Use select box(dropdown) instead of multiple choice variable
2) Create two different radio button variables with the same name in which one has all options, and the other radio button has only a few options(don't include options you need to hide)
Then write an on-change client script to show the first or second variable based on selection.
3) You can write a global UI script and use it in the client script to disable the option instead of hiding it.
http://www.servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-opti... has that script
Mark as correct or helpful as applies
Regards,
PKG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 01:24 AM
Hi,
You cannot use g_form.removeOption for a multiple-choice type of variable(radio button).
You have below options :
1) Use select box(dropdown) instead of multiple choice variable
2) Create two different radio button variables with the same name in which one has all options, and the other radio button has only a few options(don't include options you need to hide)
Then write an on-change client script to show the first or second variable based on selection.
3) You can write a global UI script and use it in the client script to disable the option instead of hiding it.
http://www.servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-opti... has that script
Mark as correct or helpful as applies
Regards,
PKG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 03:21 PM - edited 03-04-2024 03:21 PM
This solution is not correct until you correct the bad ServiceNow Guru link.