How to display attachment image in notification (not link)

fpuzon
Tera Contributor

Hey everyone,
Has anyone been able to successfuly achieve this?   I found several posts related to attachments and notifications, but most of them were on how to add an attachment ink.   I'm looking to see if we can actually have the attachment (if an image) to display in the body of the notification.   Any help is appreciated.


Thanks,

Fred

4 REPLIES 4

darius_koohmare
ServiceNow Employee
ServiceNow Employee

Hi Fred,


Did you check the following? Display an Image embedded into email notification


Since images are just attachments on the attachment table, once they are uploaded you can reference them directly into a notification using standard HTML embed code.


Hi Darius,


Thanks for your reply.   That post shows you how to add the same image to all notifications.   What I'm trying to achieve is when a user submits an incident through the 'something broken' form and adds an attachment to their incident, we want the image that the user attached to the form to display directly in the body of the notification. For example, when an incident is assigned to a specific assignment group in that notification we would like to have the attachemnt displayed in that notification rather than just a link to click on.



Thanks,


Fred


Thanks for the clarification. Unfortunately I don't have the exact answer, but I imagine it would be similar to this:



In the mail script, write a loop through the current sys_attachment records filtering by table = incident, and sys_id is the current sys_id of the given record triggering the notification. Dynamically add to the content of the email HTML embed code taking the instance url /the image file-name field.


byoung
Tera Contributor

I know this post is old but I recently found myself trying to accomplish the same type of thing. We wanted to include some images in an email notification but did not want to force the recipient to click to download images. Our solution was to attach the image to the email template and reference the attachment as the img src. You can find the attachment sys_id by choosing "view" on the actual attachment that you want to show. I included a sample of the HTML used below. Hopefully you already resolved your issue, but perhaps this can help anyone else looking to do the same thing.



sample HTML:


<img class="float-center" style="-ms-interpolation-mode: bicubic; margin: 0 auto; clear: both; display: block; float: none; max-width: 100%; outline: 0; text-align: center; text-decoration: none; width: auto;" src="sys_attachment.do?sys_id=13da9dabdb858b00a5ff71dabf9619d6" alt="" align="center" />