Email signature images are attached to incident

hatazhix
Mega Expert

Hello,

I am using Servicenow Geneva version and I have noticed that when vendor has signature with images like facebook, linkedIn and etc. Then these images will be attached to this specific incident that vendor have replied. This issue was in previous versions and there was some solutions that made note about image size or something similar, but I am looking for valid and working solution.

1 ACCEPTED SOLUTION

Hi Hai,



I know the pain. I had been looking for a perfect solution for months until I found incidents with over 300 social media icons in our instance. Unfortunately, there is not much you can do without analyzing the attachments and best option depends on what exactly want to achieve. File type and size is something that can be implemented easily and works pretty nice. Nevertheless, in our case it was not enough as images in signatures are sometimes around the size of other images(e.g. really small screenshots). I decided to implement more sophisticated solution that may still be far from perfect but worked like a charm.



If any of the below tests fails, attachment is moved to the ticket as usually. Otherwise, attachment stays intact under sys_email record.


1. Check file type(image) and size(<4096 bytes).


2. Calculate hash


3. Compare list of blacklisted hashes. The list consists of hashes of official images used by our company and our vendors.


4. Compare hashes of already attached images of the same size and type to avoid duplicates.



Magic happens in one business rule on sys_attachment table.



I cannot share the script at the moment but let me know if you would like to know more.



// Damian


View solution in original post

14 REPLIES 14

Hi Damian,



Can you share you did you achieve items 2-4 in your list?


2. Calculate hash


3. Compare list of blacklisted hashes. The list consists of hashes of official images used by our company and our vendors.


4. Compare hashes of already attached images of the same size and type to avoid duplicates.


I just wanted to share that this issue has been resolved in Jakarta using two properties. Here is the detailed information https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/administer/notification/concept/...


While this issue is solved using these 2 properties, this also has a drawback. If there is any other image with the same size, even that gets excluded.

I have written a BR to restrict the logos not added to that record, while they still exist in attachment table.

Create a BEFORE BR rule on sys_attachment table on UPDATE

Select Advanced

and put this script.  

 

Script:

(function executeRule(current, previous /*null when async*/) {

// Add your code here

if (current.file_name.toLowerCase() == ‘name.png' || current.file_name.indexOf('image0') > -1  || current.file_name.indexOf('.iix') > -1) {

 

current.setAbortAction(true);

}

 Make chagnes to this script as per your requirement. 

})(current, previous);

 

Hi Damian,

Espero que aun sigas trabajando con SNOW.

 

I find the same problem in our instance of servicenow, looking for a way to get the images from the signatures or from social networks.
At this point it should be a property that is easily defined in ServiceNow or a script, but hey...
A question, can you paste a step by step on how to do what you recommend as a solution?

It would be very useful.

 

Thank you so much..

 

Diego Canete.

Dub Myers
ServiceNow Employee
ServiceNow Employee

As of New York, a SHA256 is calculated and put into sys_attachment.hash field and this is something you can use.

See "Attachments are assigned unique identifiers" in the New York release notes.

Additionally if an email arrives with an attachment (image or otherwise), its hash is compared to other attachments on the target record that have a hash.  If the identical content already exists on the target record, the attachment is not moved to the target record, but remains on the sys_email record.