The CreatorCon Call for Content is officially open! Get started here.

Including Image File as Attachment on e-mail notifications

Lucas Romani1
Tera Contributor

Hi,

I created two fields on RITM table -> "Attachment Test" (field type = image) and "Attachment Test 2" (field type = File Attachment) and I need that the files inputed on these fields be inserted on a e-mail notification as an attachment (include link to these files on the e-mail don't work on these scenario for me, beacause external users that don't have ServiceNow accounts that needs to download and acess these files)

I did a test, and created an e-mail notification (image below) but the e-mail that was send didn't get the files attached.

Email Notification

find_real_file.png

 

Email Preview

find_real_file.png

 

Is there a way to get the files attached on these fields and send like an attachment on e-mail notification ?

1 REPLY 1

Filipe Cruz
Kilo Sage

Hello Lucas,

Please follow the steps presented in the ServiceNow documentation:

Document attachments on an email notification

You can attach documents and reports to email notifications by scripting or linking to the sys ID of the record.

You can include all attachments from the source record with the notification. For example, if an incident update generates a notification, you can include all attachments from the incident record with the notification. To include all attachments from the source record, select the check box for the Include attachments field. Note that email messages, including attachments, cannot exceed the maximum email size. This size includes MIME encoding. For details on MIME encoding, see Email service size restrictions.

Attaching documents with scripting

Using scripting, you can attach documents by linking to them, or you can attach various types of reports by specifying their IDs in the system.

Linking to an attachment

You can add an attachment to a notification by linking to the attachment record in the message of the notification. Upon clicking the link, email recipients log in to the instance to view the attachment record.

Linking to attachment records in this fashion requires using email notification scripting. For example:
template.print ( 'Attachment: <a href="/sys_attachment.do?sys_id=' + now_GR. sys_id + '">' + now_GR. file_name + '</a>\n ' ) ;

Attaching reports using the Sys ID

You can also attach various types of reports, including gauges, dashboards, and charts, to a notification. The scripts to attach these reports take the following syntax:
${report:X:Y}
where:

X is the type of report you want to attach (reportID, gaugeID, dashboardID, or chartID).

Y is the sys ID of the report, gauge, dashboard, or chart to be attached.

For example:
  • ${report:reportID:<abc123>}
    ${report:gaugeID:<abc123>}
    ${report:dashboardID:<abc123>}
    ${report:chartID:<abc123>}
Note: Multilevel pivot reports can’t attach to email notifications.
 

Please, if this answer is relevant for you, please mark it as correct and helpful.

Thanks,

Filipe