Hide Variable based on Select Box choices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 11:34 PM
I have a select box variable with multiple choices, I need to show other variables based on select box choices.
- If choice A is selected, variable AB and AC should be visible.
- If choice B is selected, only variable AB should be visible.
Am able to achieve the condition through onChange client script but when I select A first and then B, it is not hiding AC.
if(choice == "A"){
g_form.setVisible('AB', true);
g_form.setVisible('BC', true);
}
if(choice == "B"){
g_form.setVisible('AB', true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2025 12:02 AM
@Ankur Bawiskar Logic is not working, when selecting choice B after A, It's not hiding the variable AC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2025 12:05 AM
is that variable mandatory? if yes then it won't hide unless you make it non-mandatory
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2025 12:06 AM
No, that variable is not mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2025 12:59 AM
then script should work fine.
please share your complete script here and what debugging did you perform
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2025 02:02 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader