How to Hide/Show choice in Multiple choice variable based on other variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 04:43 AM
Hello Team,
I have requirement to hide/show the one choice in Multiple choice variable in catalog item.
Two variables we have,
1. checklist (name : Virtual meeting).
2. Multiple choice : It has below three choices
1.AB
2.BA
3.CD
when I select the checklist (Virtual meeting) "BA" has to hide.
when I unselect the checklist (Virtual meeting) "BA" has to show.
Please help me on this requirement.
@Mohith Devatte
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 05:50 AM
Hi @vinod9
You can write onChange Catalog client script on Virtual meeting(checklist( variable with below code:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(!newValue==true)
{
g_form.clearOptions('virtual_meeting');
g_form.addOption('virtual_meeting, 'AB', '1.AB', 1);
g_form.addOption('virtual_meeting, 'BA', '2.BA', 2);
g_form.addOption('virtual_meeting, 'CD', '3.CD', 3);
}
else {
g_form.clearOptions('virtual_meeting');
g_form.addOption('virtual_meeting, 'AB', '1.AB', 1);
g_form.addOption('virtual_meeting, 'CD', '3.CD', 3);
}
// update field name and values according to your variables and choices.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023