Maximum length not working for String fields

eshwar10
Giga Contributor

Hi,

I came across something very weird, There is a table called task_time_worked which has a String field called "Comments" and the max length defined for it in dictionary is 1000. But when I fill the Comments fields with more than 1000, heck even when i give 10000 words it is still getting saved. The same issue was found for the "Description" field in the incident table which has a max length of 4000, i was able to save the incident even when i gave description which more than 10000 words. It is getting saved and whatever is given it is getting saved as description. Kindly provide your insights...

P.S : I tested the description field in my own dev instance, the result is still the same.

Thanks,

Eshwar

1 ACCEPTED SOLUTION

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

The field on database side is created as a mediumtext which is why you see this behavior. The restriction is only done via our platform.



See info about mediumtext:


mysql - TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT maximum storage sizes - Stack Overflow


View solution in original post

2 REPLIES 2

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

The field on database side is created as a mediumtext which is why you see this behavior. The restriction is only done via our platform.



See info about mediumtext:


mysql - TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT maximum storage sizes - Stack Overflow


Gaurav Bajaj
Kilo Sage

Hi Eshwar,



This is OOB behavior. I have seen it in my instance too.


For workaround solution, you can write onsubmit client script to check the limit for max length and return   error message on form.



https://www.servicenowguru.com/scripting/client-scripts-scripting/maximum-length-large-string-fields...