How to Hide/Show choice in Multiple choice variable based on other variable.

vinod9
Tera Expert

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 

@AnubhavRitolia 

@Gunjan Kiratkar 

@

 

 

5 REPLIES 5

AnubhavRitolia
Mega Sage
Mega Sage

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.

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023