Attachment loses its file extension when length of the filename exceeds the limit

stevedag
Kilo Expert

Is there a way to keep the file extension when a user puts an attachment with a filename that exceeds the limit set in ServiceNow?

 

I know we can change the maximum lenght of the filename in the sys_attachment table, but that's not what I want.     I would like to cut the filename to the default 100 caracters limit, but to keep its file extension.   This way, although the filename has been truncated, our users will still be able to open it.


Thanks!

Steve

23 REPLIES 23

hmm the docx extension works fine when the length is < 100


+edit made to max_length



Can you try changing the the dictionary entry for the file_name to max length=254.



I remember reading somewhere that this is the maximum it can be for the field type 'string'. if you need to go bigger you have to change the field type.



Once you have changed it, try attaching a file with a name >100 characters but <254 - and see if it shows the extension.



I'm just looked at my test instance (Eureka patch 😎 and I see two attachment tables:



sys_attachment


sys_attachment2



Which one are you using?


I am using sys_attachment table. I modified the file_name field max length to 260. Now when I try to reduce the max length, it wonnot let me do for some reason.


At this point i would clone to get my tables back to where they were before you made the changes - hopefully you're doing this on a test instance



Or you can open a Hi request...


YOu are correct .. 254 did the trick.