How would I get an attached image from the catalog item to show in the body of the email?

Oscar14
Tera Contributor

Hi All,

I am working on a Catalog item that has an attachment variable. When the catalog item is submitted, it's suppose to send an email with all the variables in the form, including the attachment. I am using flow designer. I know how to have the image attached to a email but I want to know if it's possible to have the image in the body of the email along with all the other variables in the catalog item.

How would I get the attached image from the catalog item into the body of the email?

2 REPLIES 2

Allen Andreas
Administrator
Administrator

Hi,

You can accomplish this by creating a mail script with code such as:

template.print("<img src=/sys_attachment.do?sys_id=" + current.variables.name_of_attachment_variable + ">");

So for example, I have a catalog item with an attachment variable like so:

find_real_file.png

Label is: Attach image and variable name is: attach_image

So I created the mail script and replaced "name_of_attachment_variable" with the name of the variable and then associate that mail script in the body of the notification such as:

find_real_file.png

And then when it's sent, it'll look like this:

find_real_file.png

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

I actually just finished writing an article about how to do this since I felt it was useful information and others may benefit as well: https://community.servicenow.com/community?id=community_article&sys_id=de11582ddb46c514fd63250913961...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!