Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Help with catalog item form

cicgordy
Tera Guru

Hi all,

I have created a catalog item and I have two reference fields on the form: "office_location" which references the "cmn_location" table and "choose_the_software" which references the "u_software" table.

 

If I select "New York" as office location, I want to then be able to hide the software "Cube3D" optionfrom the choose_the_software reference field.

 

Can anyone help with catalog client script please?

Thanks

12 REPLIES 12

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @cicgordy 

 

You need to write a client script for the same mate.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

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

Hi @Dr Atul G- LNG , yes I needed help writing a client script please.

Hi @cicgordy 

 

I am not coder 🙄 but these can help you

 

https://www.servicenow.com/community/csm-forum/how-to-hide-field-choices-based-on-the-other-field-ch...

 

https://www.servicenow.com/community/developer-forum/show-hide-choices-of-field-based-on-selection-o...

Check Ankur reply. 

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading) {
      return;
   }

g_form.clearOptions('request_type');

if(newValue == 'Card Swipe Unit'){

g_form.addOption('request_type', choicevalue, choiceLabel);
g_form.addOption('request_type', choicevalue, choiceLabel);

}

}
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

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

Sandeep Rajput
Tera Patron
Tera Patron

@cicgordy You will not be able to handle this via a client script as both office_location and choose_the_software are reference fields here.

 

In order to address this requirement, you will have to create an advanced reference qualifier on the choose_the_software variable. This reference qualifier will use a script include to return the software for a specific location.

 

Do you have a location column on the table being referenced in choose_the_software field?