- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 08:38 PM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 08:52 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 01:22 AM
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"))
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 03:56 PM
Thank you.
I'll give it a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 09:27 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 09:40 PM
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