Change the attachment fine name size

Black Coder
Tera Guru

Hi 

I changed the attachment file name size limit from 100 to 255 in sys_attachement table.Once again when I try to change to file name character size to 100, it is showing error as " Length change not allowed. The field 'File name' on table 'Attachment' contains existing data records (40) that exceed the new length of 100". But in this can what can I do??However i need to change the file name character limit to 100.

1 ACCEPTED SOLUTION

Mark Stanger
Giga Sage

The only thing you can do is go into the 'sys_attachment' table and find all of the records where the file name is greater than 100 characters and change them to something less.  Here's a script you can run from 'Scripts -> Background' in your left nav to identify the problem records.

var att = new GlideRecord('sys_attachment');
att.query();
while (att.next()) {
    var name = att.file_name.toString();
    if (name.length > 100) {
        gs.print(att.file_name);
    }
}

View solution in original post

7 REPLIES 7

i used this script and found some attachment and renamed it.still it is showing 25 more attachment available which are more than 100 characters.

Nothing to do but keep running the script and renaming until you don't find any more.

Jaydeep Parmar
Kilo Guru

Hi, Faiq

Goto--> sys_attachment.list table then

Right click on File Name---> Configure--> Dictionary---> find column name as file_name

set Max Size 100 to 200 or more

Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.

Jaydeep Parmar

find_real_file.png