Is there a way to avoid the max length check for the table?

Yuki21
Tera Expert

Hello.
An error occurs when changing the maximum length of the table from 1000 to 160.
Is there a way to temporarily disable the check?

Which one should I deactivate?
UI action? business rules?
data policy?

 

aキャプチャ.PNG

キャプチャ.PNG

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, I assume that the field size was increased, and records then populated to the higher limit and now you are rolling back to OOB size?

The system is preventing your change as data will be lost\truncated\corrupted and I think that the correct fix for this would be to review and resolve issues with your data exceeding the field length and then make the size change.

If you don't care about loosing data then you could just set the field content to '' where the string size exceeds 160 char or truncate to 160 char before you run your script.

 

View solution in original post

8 REPLIES 8

@Yuki21 

It seems that "bytes count" is be checked ,not "Character count". 

Refer : https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0726986 

 

So try this.

 

var gr = new GlideRecord("incident")
gr.query()
while(gr.next()){
  if(gr.getValue("description") && encodeURIComponent(gr.getValue("description")).replace(/%../g,"x").length > 160 ){
    gs.info(gr.getValue("number"))
   
   }

}

 

Please mark my answer as correct and helpful based on Impact.

Thank you.
I'll give it a try.

I am not sure if it is possible to bypass ServiceNow's data protection functionality, but I would not advise it - even if there was just simply deactivating a BR.
Doing so would not be best practice and learning to work within the platforms constraints is one of the most important things a ServiceNow developer should learn.

 

The fix would be to run a background script and truncate impacted records or all records, then update the field.

RaghavSh
Kilo Patron

You cannot change the length of a column if the column has some value in it. In fact you cannot change anything on dictionary level (type or length) of a column on table if that column stores any value.

 

Refer : https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0726986 


Raghav
MVP 2023