Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to make a field appear when a certain drop down is selected

DeIvory Gordon
Tera Guru

Hello, 

 

I created a catalog item with the following drop down: 

Account Type:
Employee
Contractor/Vendor

 

If Employee is chosen, give a drop down with the following choices for Country:
Mexico
Brazil

 

if Contractor is chosen, alter the Country choices to the below:
United States
Canada
Mexico
Brazil

 

How do I do this using a UI policy and without creating a script?  Please provide simple instructions.  Thank you!

1 ACCEPTED SOLUTION

Dr Atul G- LNG
Tera Patron

Hi @DeIvory Gordon 

 

https://www.servicenow.com/community/developer-forum/display-fields-in-catalog-item-on-selection-of-...

 

You can try Onchange catalog client script to make the variables visible only if the ChoiceB is selected

if (g_form.getValue('Variablename') == 'ChoiceB') {
g_form.setVisible('Variablename1', true);
g_form.setVisible('variabename2', true);

} else {
g_form.setVisible('Variablename1', false);
g_form.setVisible('variabename2', false);
}

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.
 
credits : @Omkar Kumbhar 

 

 

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

1 REPLY 1

Dr Atul G- LNG
Tera Patron

Hi @DeIvory Gordon 

 

https://www.servicenow.com/community/developer-forum/display-fields-in-catalog-item-on-selection-of-...

 

You can try Onchange catalog client script to make the variables visible only if the ChoiceB is selected

if (g_form.getValue('Variablename') == 'ChoiceB') {
g_form.setVisible('Variablename1', true);
g_form.setVisible('variabename2', true);

} else {
g_form.setVisible('Variablename1', false);
g_form.setVisible('variabename2', false);
}

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.
 
credits : @Omkar Kumbhar 

 

 

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************