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

vinod9
Tera Expert

Hello Team

I have requirement on catalog item to hide the choice in multiple choice variable based on other variable.

When I select the "call meeting check box"  ' IT ' has to hide from the Multiple choice. 
Please find below screen shot for more details.

vinod9_0-1670493328708.png

 

vinod9_1-1670493586787.png

 

 

vinod9_2-1670493659615.png

 

1 ACCEPTED SOLUTION

Gunjan Kiratkar
Kilo Patron

Hi @vinod9 ,

First of all change the type of 'Please select the choices ' to select box. As removeOption method is not working for multiple choices type.

After that :

catalog UI policy:-

GunjanKiratkar_0-1670494744404.png

 

Script :-

GunjanKiratkar_1-1670494770841.png

 

if True :-

function onCondition() {
	g_form.removeOption('please_select_the_choice','it');

}

 

If False:-

function onCondition() {
    g_form.addOption('please_select_the_choice', 'it','IT','1');
}

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

4 REPLIES 4

Gunjan Kiratkar
Kilo Patron

Hi @vinod9 ,

First of all change the type of 'Please select the choices ' to select box. As removeOption method is not working for multiple choices type.

After that :

catalog UI policy:-

GunjanKiratkar_0-1670494744404.png

 

Script :-

GunjanKiratkar_1-1670494770841.png

 

if True :-

function onCondition() {
	g_form.removeOption('please_select_the_choice','it');

}

 

If False:-

function onCondition() {
    g_form.addOption('please_select_the_choice', 'it','IT','1');
}

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

vinod9
Tera Expert

Thank you so much 🙂 @Gunjan Kiratkar 

Ashish Patil
Tera Contributor

Hi Gajanan,

The requested code is not working on Portal side. Its working on Native side.

Ashish Patil
Tera Contributor

Hi Vinod,

 

Portal side script is not working. Any suggestion.