On change client script not working

jack33
Tera Expert

Hi All,

 

I have 2 fields on form 'Field 1' and 'Field 2'. based on these two fields I am adding option to 'Field 3'.

If 'Field 1' is selected showing option 'abc' in Field 3 drop down with currently available choices. And if 'Field 2' selected showing 'xyz'. For this created 2 on change client script for 'Field 1' an 'Field 2' separately

which is working fine.

 

Now the issue is, if I am changing any field other than 'Field 1' and 'Field 2' both 'abc' and 'xyz' become visible in 'Field 3' dropdown.

 

Please let me know is the any way with which I can control this. Thank you in Advance

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@jack33 

that's because some other client script is setting Field 1 or Field 2 and hence Field 3 options are getting manipulated

identify that script

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@jack33 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 

Thank you for your response

 

The scripts I created are on Field 1 and Field 2 on change.

Field 3 options are again dependent on field 4. When form loads everything looks perfect ,when change happen in Field 1 and 2 everything works. But when I change field 4 and again select previous value at that time, all options get visible in Field 3 drop down. So I applied one  more on change client script on Field 4 but no luck

@jack33 

is your Field 4 client script setting any value on Field 1 or Field 2?

if yes then that will trigger respective onchange client scripts and choices will get impacted.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader