Including Image File as Attachment on e-mail notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 01:02 PM
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
Email Preview
Is there a way to get the files attached on these fields and send like an attachment on e-mail notification ?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 01:54 PM
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.
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
${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.
-
${report:reportID:<abc123>} ${report:gaugeID:<abc123>} ${report:dashboardID:<abc123>} ${report:chartID:<abc123>}
Please, if this answer is relevant for you, please mark it as correct and helpful.
Thanks,
Filipe