The Description field on Case table is accepting more than define max size of 4000 Char
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
The Description field on Case table is accepting more than define max size of 4000 Char. Please suggest the reason for the same as it should be restricted to max_size & truncate extra char.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
Hi @Abhi53 ,
This is expected platform behaviour. Max length on a string field doesn't act as a hard limit on save. Fields longer than 255 characters are stored in a large text column (mediumtext), so values over 4000 characters are saved without being cut off. ServiceNow covers this in KB0685779, "Fields in ServiceNow accept string inputs greater than the sys_dictionary max_length value".
To enforce the limit, add a before insert/update business rule on the Case table:
(function executeRule(current, previous) {
var max = 4000;
if (current.description && current.description.toString().length > max) {
current.description = current.description.toString().substring(0, max);
// Or block the save instead:
// gs.addErrorMessage('Description cannot exceed 4000 characters.');
// current.setAbortAction(true);
}
})(current, previous);This also covers records created through integrations, email and the API. If you want users to be warned on the form as they type, you can add an onChange client script as well.
reference :https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0685779
If this helped, please mark it as the accepted solution and click Helpful so others can find it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago - last edited 8 hours ago
Hi @Abhi53
This is expected Behavior.
Refer KB: KB0685779 Why ServiceNow fields accept string inputs that exceed the max_length value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hello @Abhi53 ,
Refer this :
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0623379
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0685779
You can restrict char limit by using onsubmit/onchange client script or BR also .
If this helps you then mark it as helpful and accept as solution .
Regards,
Aditya