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.

client script for two choice type fields

GBS
Tera Contributor

I have two choice type fields named State and City in a table. If I select a state in the state field, only cities that belong to the selected state must be visible in the City field.

 

Can anyone help me with the client script.

7 REPLIES 7

Amit Verma
Kilo Patron
Kilo Patron

Hi @GBS 

 

From where you are getting the information for state and city? I am assuming that it is being fetched from a REST API response. If yes, you need to configure a script include to fetch the API response and pass it on the two fields via an On-Change client script on the state field. 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @GBS 

 

You can use same way the way we have assignment group and Assigned to.

LearnNGrowAtul_0-1702985872098.png

 

*************************************************************************************************************
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]

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

GBS
Tera Contributor

both the fields are not reference type they are choice type 

Hi @GBS 

 

Make reference and your life will be easy in this case. The value in choices must not more than 8-10 , if you make City and state choices it is too much to maintain. 

*************************************************************************************************************
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]

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