How to prevent specific header and footer files from being attached to incident records


Description

When end users reply to Emails that were sent out from your instance, then Image logos that were sent out are sent back to Servicenow and re-attached indefinitely again. 'image header.jpeg', 'image header 1.jpeg'. 'image header 2.jpeg' etc ...

Release or Environment

All

Cause

This is expected behaviour for Inbound Actions to automatically upload attachments / files embedded in Emails to the current record being added or updated.

Resolution

It is possible to customize this behaviour by scripting. Please bear in mind that this jus a sample using the file name, it is also possible to filter on image size

Business Rules xyz on table [sys_attachment]
When to run: Before Insert
Conditions: current.table_name == 'incident' && (current.content_type == 'image/png' || current.content_type == 'image/jpeg') && (current.file_name.indexOf('Your Email Template Footer')!= -1 || current.file_name.indexOf('Your Email Template Header')!= -1)

(function executeRule(current, previous /*null when async*/) {
current.setAbortAction(true);
})(current, previous);

For a more general approach based on the file size using system properties, refer to the article Inbound Emails with Attachment icons / Logos / Signatures Images Adds Duplicate Attachments and Repeates in Activity Notes Of Target Record