- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 11:34 PM
I have below code which is working fine in DEV but not in PROD. Please let me know how can I get this resolved.
Thanks in Advacne
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
var maxCharacters = 450;
var fieldValue = g_form.getValue('executive_summary');
if (fieldValue.length > maxCharacters) {
g_form.setValue('executive_summary', fieldValue.substring(0, maxCharacters));
alert('Maximum character limit reached. Field has been truncated to ' + maxCharacters + ' characters.');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 06:54 PM
Found issue why it is was not working.
But thank you Jaspal and Ankur for your time

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 11:39 PM
Hi Jagadish,
Are the field/variable name/s similar in both the instances? When you say not working do you get alert or there is no alert at all?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 11:42 PM
Hi Jaspal,
Alert message comes in PROD but when I click on okay, it must truncate the characters after 450 but it is not happening. Instead alert message keeps poping up and I am unable to close the alert message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 12:23 AM
it seems it's getting into loop everytime you are validating and setting the value
you should try to replicate it in dev so that you can debug it further
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 12:27 AM
Hi Ankur,
I tried in DEV but it now looping as it is looping in PROD.
Same test characters were passed in both instances