Is there any way to find MIME type mismatch files in ServiceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018 01:37 PM
Hi ,
In ServiceNow is there any way to find MIME type mismatch files from sys_attachment table by scripting?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018 11:44 PM
Hello,
Please see this documentation:
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 are checked for MIME type during upload.
https://docs.servicenow.com/bundle/jakarta-platform-administration/page/administer/security/reference/r_GeneralSecuritySettings.html
https://docs.servicenow.com/bundle/jakarta-platform-administration/page/administer/security/concept/c_HighSecuritySettings.html
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2018 07:20 AM
Thanks Bhawana for your response
We have 300k+ attachments on sys_attachment table,from there i need to find MIME type attachments.Is there any way to do that?
Can you help me with this

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2018 07:41 AM
The attachments that are allowed into Service Now are determined by the System property - security- glide.attachment.extensions - if this property is blank, that means all types of attachments are allowed in the system.
var attach = new GlideRecord('sys_attachment');
attach.addQuery('table_sys_id',current.sys_id);
attach.query();
if(attach.next()){//use `while` if dealing with multiple attachments
if(attach.getValue('file_name').indexOf('pdf') != -1{//meaning if you can find a file with pdf extension
//do something
}
}
If the response is useful, mark the answer correct and helpful.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2018 11:52 AM
How to check if the file is of MIME type inside this if loop?