There are several common error messages that a user might receive in certain cases when attempting to upload an attachment to a record on a ServiceNow instance. This article will describe some of the most common of these error messages and the cause of that error message appearing. Below are listed three of the most common error messages that might be received and a screenshot showing an example of the error:
User attempts to add attachment to a specific record on a customer instance and receives an error message indicating the file contains a prohibited file extension, and the attachment is disallowed.
This message will read as follows:
<File_Name> has a prohibited file extension.
Upon attempting to upload an attachment to a record the user receives a message regarding a MIME type not synchronized with the actual file name.
<File_Name>: File type not permitted or mime type does not match the file content
The following error message may also sometimes appear when a user attempts to add an attachment to a record on the instance.
<File_Name> is <File_Size>. The maximum file size is <Maximum_Size>.
There is usually a specific major cause for each of these messages appearing and the resulting inability to attach the file to the record. Most of these issues are caused by the current setting of a specific system property on the instance.
The usual cause of the first issue (prohibited file extension) is that the instance currently is configured to block all file type attachments except a specific whitelist of file type extensions. By default, on a new out-of-box instance there are no such restrictions, however many customers, for security reasons, will configure the instance to only allow specific file extension types to be uploaded and attached to records on the instance.
Thus, it is probable that the file extension type of the file which the user is attempting to attach to the record is not on the configured list of allowable file extension types. If the system property is blank, the system will not restrict file extensions for attached files.
Important Note: It should also be noted that the during the attachment process, the file extension is converted to lower case. Thus, in order to ensure parity with the names found in this file extension list, any file extensions typed in for this property should always be in all lower case letters.
The cause of the second issue is similar to the first issue, but is due to a mismatch amongst the file extension and MIME type of the file that is attempting to be added to the instance. Thus, for instance the file itself may be internally represented with a MIME type of .pdf but the file extension as part of the filename itself, is showing as .rtf. This checking is controlled by a specific system property on the instance.
The usual cause of the third error message is because the file attempting to be uploaded is of larger size than the maximum allowable attachment file size on the instance. The default setting for this property on a new, out-of-box instance is 1024 MB, but this value can be adjusted by the instance System Administrator.
Many of these issues can often be resolved on a per-case basis by the individual to ensure the file can still be attached. However, in certain cases, the system configuration may need to be adjusted if these issues are frequently occurring for users performing essential job functions.
Each of these issues will be briefly examined.
Prohibited File Extension
For the issue regarding an disallowed file type, the end user can often attempt to save the file in a different format. For example, for a text file, most text editor programs will allow the file to be saved in a variety of formats. Thus, if one particular file format is not allowed, another type can be tried. This is particularly true for text editors and image editing programs.
The .zip file extension is often (but not necessarily always) included as an allowable file extension, so in some cases if a conforming file type cannot be found, the file can be compressed into a .zip type format (which, as a result will create a new compressed version of the file with a .zip file extension) and then attached.
If having trouble finding a format that will allow the file to be attached, the System Administrator of the system should be contacted and asked what the allowable file extensions are. In certain cases, a new allowable file extension may need to be added to the list of these allowable extensions. If this does become necessary, the following steps can be performed:
Log into the instance with an account having admin rights to the instance.
Browse to the following location on the instance: System Properties -> Security.
The Security System Properties page will appear. Locate the property headed by the text "List of file extensions (comma-separated) that can be attached to documents via the attachment dialog. Extensions should not include the dot (.) e.g. xls,xlsx,doc,docx. Leave blank to allow all extensions."
Extensions should not include the dot (as an example, the list might be configured to show as; xls,xlsx,doc,docx). Leave blank to allow an attachment to be included with any file extension. Add any necessary values to the end of the list. Each file extension type in the list should be added on the end of the list and delimited fro the previous text in that field (if any) by a comma. The name should not include the .dot operator as this is already assumed by the system, and doing so will cause the extension to not be properly recognized. The file extension should also be typed in all lower case letters, as the system, when running the comparison to the extension list, will convert the file extension to lower case. The default setting for this property for a new out-of-box instance is to be blank, which indicates that all file extensions are allowed. Thus, clearing the value in this field will allow any file extensions to be uploaded to a record on the instance. After making the necessary adjustments to the property, click one of the Save buttons found on the properties page (either at the top or bottom of the page).
Alternatively, the settings of this property can be adjusted directly from the System Properties table by opening the sys_properties record with the name glide.attachment.extensions and updating the Value field of the property with the appropriate list of allowable extension types.
Important Note: It should be noted that the system does not actually check if the attached file is actually of the same MIME type as the attached file. For this property, the system is simply comparing the file extension of the file with the list of allowable file extension types as configured in this list.
File Type Not Permitted
For the issue in which an error message is received indicating that the file type is not permitted, this usually indicates that the internal MIME type representation of the file is different than the current file extension for this file. In this case, if the internal file type is known, the file extension should be changed to the proper file type representing that file. If this is not one of the prohibited file extensions, the file should then be able to be uploaded as needed. As in the previous error message, the .zip extension is often included in the allowable file extensions. Thus, compressing the file (which will result in a file with a .zip file extension) and then attaching the compressed file should allow the file to be attached as needed.
If, for some reason this option needs to be disabled, it can be done, by a System Administrator from the Security Properties page on the instance. To do this, perform the following steps:
Login to the instance with an account having admin rights to the instance.
Using the Menu Navigator, browse to the following location on the instance: System Properties-> Security.
From the Security properties page that appears, locate the property which has the heading of "This property must be set to activate MIME type checking for uploads (All version Eureka and up). Enables (true) or disables (false) mime type validation for file attachments. File extensions configured via glide.attachment.extensions will be checked for MIME type during upload." This is a boolean property. Thus to de-activate the property ensure the checkbox shows as unchecked (set to a value of No). To recheck the property reset the property (ensure the value shows as checked). After setting the property to the necessary value, click the Save button at the top or bottom of the page. The default setting for this property on an out of box instance is No (unchecked).
Note that this adjustment could also be made directly from the sys_properties record for this property. The name of the property is glide.security.file.mime_type.validation. The property is stored in the instance as a true/false property, so the value can be turned on by selecting true and turned off by selecting false.
Maximum File Size Error
For the issue in which the file cannot be attached due to the fact that the file size is larger than the configured maximum size on the instance, the best option is to compress the file and then attempt to attach the file again. If the file is still too large after compression, check with the System Administrator as the maximum file size setting may need to be adjusted. The default setting for this property in a new out-of-box instance is 1024 MB.
To adjust this maximum file size, the following steps can be performed:
Log into the instance with an account having admin rights to the instance.
Browse to the following location on the instance: System Properties-> Security.
The Security System Properties page will appear. Locate the property on the page that shows the header "Maximum file attachment size in megabytes". Set the property to the necessary setting. Setting this to a blank value will allow unlimited size for these attachments (up to the 1 GB maximum attachment size specified at the system level). After setting this value to the necessary size, click the Save button at the top or bottom of the Security Properties page.
Note that, as with the other settings on this page, the value for this property can also be set directly from the sys_properties record corresponding to this property setting. The property name is com.glide.attachment.max_size. The property is an integer value, so the value setting should be set to the necessary value (shown in Megabytes).
Note that there are actually a different set of properties that control attachment settings for emails. However, the Maximum File Attachment Size setting as described above will override the maximum size set for the Email settings if this property is set to a lower maximum threshold.