- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2017 04:05 PM
How can we embed a Document in a email notification. I just find embedding a link to a document in Servicenow but could not find attaching a file to a notification. I am not looking to send atachments of a record to email notification but sending a standard document (same document) in a specific type of notifications
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 10:05 AM
Hi Mohammed,
The only way you can do this is by attaching the document with the specific record and then selecting option "Include attachments" with notification.
In my case as I needed to send a attachment with approval record.
#First I uploaded the document which I have to sent with each approval in Knowledge Base.
#Then I created Approval record using script and copied the knowledge document to the newly created approval record.
# Then used a event queue to sent approval notification , once attachment is copied. (I do made sure to select option "include attachments" in email notification prioperties.)
var grRec = new GlideRecord('sysapproval_approver');
grRec.initialize();
grRec.approver = current.variables.manager;
grRec.source_table = 'sc_req_item';
grRec.document_id = current.sys_id;
grRec.sysapproval = current.sys_id;
grRec.document_table = 'sc_req_item';
grRec.state = 'requested';
grRec.insert();
GlideSysAttachment.copy('kb_knowledge', '92608c264fa0cb80f0cfe0024210c764', 'sysapproval_approver', grRec.sys_id);
gs.eventQueue('test.approval.notification',grRec,current.variables.manager);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2017 04:33 PM
Setting the 'Include attachments' field on the notification to true will include all attachments from the current record that is triggering the notification. So if you attach an attachment to a record, and theres a notification on that record with 'include attachments' set to true, the attachments will also send.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 10:12 AM
I am not looking for attachments from a specific record. I already have this setting in my notification. So consider the scenario. I have a employee checklist document and I want to sent this same document with every new Hire request. So this document is not associated with any particular record......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 01:39 AM
Hello Rajeev,
Create the following script
Name: Include Attachments in an Email Notification
Type:
Table:
Description: Include this in the email notification or template to include attachments. Replace INSTANCE with your instance name.
Parameters:
Script:
printattachments();
function printattachments()
{ var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_sys_id',current.sys_id);
gr.query();
while (gr.next())
{ template.print('Attachment: <a href="http://'+gs.getProperty("instance_name")+'.service-now.com/sys_attachment.do?sys_id=' + gr.sys_id + '">' + gr.file_name + '</a>'); } }
Have a look at these articles:
http://wiki.servicenow.com/index.php?title=Include_Attachments_in_an_Email_Notification#gsc.tab=0
Document attachments on an email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 10:21 AM
Hi Rajeev I just ran into the same issue. I believe the solution Dravvy has described above is the only way to do this - you must create a mail script using the code above which creates a link to the attachment in Service Now (just attach the file to the Notification to get it into the attachments table and then call the mail script in your Notification)