Brad Bowman
Mega Patron

For your testing, just know that since you have a script that runs onChange of field 1 and depends on field 2, that field 2 must be populated before field 1.  Once you get this working add an exclusion to not run if field 2 is empty, or whatever fits your use case, then create a similar script onChange of field 2 so that no matter what order the 2 fields are populated in, the script will still run.

 

As far as why it's not working, you'll have to add some alerts on f1 and f2 which will confirm that those field names are correct, and the value you are testing for (newValue/f1 and f2) is expected.  It doesn't make sense to clearOptions then removeOptions for individual choices, so do one or the other as clearOptions will remove all options.  If you take this line out, make sure 'Test' is the value of the choice record, not the label.

View solution in original post

Hi Brad, I tried this route and it is working .Thankyou very much

You are welcome!

Dr Atul - LNG
Tera Patron

Hi @divyakosaraju 

 

Did you try the data lookup way, create a lookup table,

 

Match the choices and set the results.

 

Have a look ootb priority lookup and try once.

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

Harish Bainsla
Kilo Patron

Hi

you can make field dependent on others

please refer below video

https://youtu.be/jiR4DjpmlRM?si=4i4sypOwNoC_Sgz3

In this video dependency between two field has been created which will let you know that how the configuration of dependent choice list has be done in servicenow. I hope this video help you to understand the required topic i.e. dependent choice list servicenow. Please do not forget to like, share