String field max size is not being enforced
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2018 08:12 AM
There are several string fields within my custom application that have form boxes larger than they should. They are displaying as multiline when they should not be.
When I did some investigation I discovered several things:
- There were no styles specified
- Max field size is set to 20 (note that 55 characters were entered and saved in the above screen shot)
- There are no client scripts, business rules, etc related to the field
- Changing the field size did nothing to change the behavior
- Deleting the field and then creating a whole new column resulted in the same behavior
- Setting a field attribute ("default_rows=1") was ineffective
- Setting form style height did nothing.
I found several posts in the community explaining that string fields are created as mediumtext db fields, but offered no solutions to the problem, nor an explanation as to why the "Max length" dictionary property is not working.
My client is not happy that these fields are not displaying correctly. Does anyone have a fix for this problem, or know if ServiceNow is aware of this problem and are patching it?
EDIT: we are using the latest version of Kingston
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2018 12:39 AM
Hi,
That is how the String field behaves. After certain limit if any value is larger than the max length of this field the ServiceNow increases the length of this string field in database to a larger value.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 11:17 PM
That is very odd. We have a set a String field to max length 1000 but could see many records where 1000+ characters have been entered.
Is there any KB from ServiceNow that explains why they are doing this so? What's the point of having the max length attribute then?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2024 11:44 PM
Hi,
Theres a description of how it works here.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0685779
It could be interesting to test the limit less and more than 40 chars which seems to be the minimum length of a string field though.
But also check short_description for ex - it actually limits the amount of chars that can be entered - but again, it probably depends on the DB length (varchar(160) etc)