Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

display image in email body

anilkp
Kilo Contributor

Hi All, 

We have a requirement to display an image in email body (Not as attachment). Image displays properly when i preview email in service now but image is not seen in customer mail box. 

Below is the logic currently used in email script - url is reference to sys_attachment table where image is located. 

<img src=' + url + '>'

This is not able to fetch image from sys_attachment & load it on to email. 

Kindly let me know how to implement this scenario. 

Thanks. 


Regards,

Anil KP 

 

1 ACCEPTED SOLUTION

Better create a business rule on insert on Attachment table when content type is Image/JPEG that copies the attachment to image (db_image) table & then use the above script.

View solution in original post

11 REPLIES 11

Hi Kaushik, Thanks for the reply but my requirement is not fixed image to be in email. I have to send image attached to incident in email. So i'm referring for image in sys_attachment table & constructing URL to this - 

var url = gs.getProperty('custome_url') + "/sys_attachment.do?sysparm_referring_url=tear_off&view=true&sys_id=" + attachment ;


template.print(ind.getMessage("Customer Signature ", lang) +' '+ '<img src=' + url + '>' + "<br><br>" ); 

 

I can see image on body of email while preview but not in actual email

Hi Anil,

Have you implemented the functionality? I also have similar requirement. Want to display the images that are attached in the incidents on the email body. Can you help me.

 

Regards,

Arun