onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 12:15 AM
When the sample number field is filled, Escalation Manager should auto populate based on the sample number field values. The sample number has different managers and it is stored in sample_data_1 table. I have written a script include and on change client script to populate the value based on the sample number selection but its not working.
Errors which I'm facing for this script:
1. onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }
2. The escalation manager field is auto populating for a while and getting vanished.
3. If the sample data is filled and changed, the escalation manager value is not populating.
Script Include:
On change client script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 12:32 AM
Hi @Mahalakshmi Rav ,
Please make sure that you script include is client callable and g_form.setValue('escalation_manager', false) should be g_form.setValue('escalation_manager', response).
Make correction here as well.
return ''"; // Return an empty string if no matching record is found
If my response helped, please hit the Thumb Icon and accept the solution so that it benefits future readers.
Regards,
Rohit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 12:42 AM
Your script include is not the Client Callable one that uses for GlideAjax.
Give me adjustment below a try
var EscalationManagerUtil = Class.create();
EscalationManagerUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getEscalationManager: function() {
var sampleNumber = this.getParameter('sysparm_sampleNumber');
var gr = new GlideRecord('sample_data_1');
gr.addQuery('sample_number', sampleNumber);
gr.query();
if (gr.next()) {
return gr.getValue('escalation _manager');
}
return '';
},
type: 'EscalationManagerUtil'
});
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 04:27 AM
Hi @Rohit Singh and @Tai Vu ,
I tried as per your suggestions, still it's not working. Also, my script include is a client callable one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 04:31 AM
So you are in a scoped app
Is both script include and client script in same scope?
Try to debug step by step
1) check if script include is getting called
Seems your client script is setting "escalation_manager" which in turn is triggering another client script and hence it's causing some recursion
did you check that?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader