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.

error onChange script error: RangeError: Maximum call stack size exceeded function ()

yoli1
Tera Contributor

Hi all, I have two onchange client scripts. Whenever field A changes, field B gets updated, and vice versa. The same applies to field B; when it changes, field A gets updated. However, I'm encountering an error: onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] } It seems to be a loop between both onchange client scripts. Any ideas on how to solve this?

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @yoli1 

 

The JavaScript RangeError: Maximum call stack size exceeded happens when a function keeps calling itself without any condition to stop, and eventually, the program runs out of space to keep track of these repeated calls. It's a sign that your program needs a way to stop the function from calling itself endlessly

 

Check the order of the client scripts.

 

https://www.servicenow.com/community/itsm-forum/getting-error-onchange-script-error-rangeerror-maxim...

https://www.servicenow.com/community/csm-forum/how-to-solve-onchange-script-error-rangeerror-maximum...

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

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

Danish Bhairag2
Tera Sage

Hi @yoli1 ,

 

Can u share ur script?

 

Thanks,

Danish