Attachment in email notification

rajeevlochan82
Mega Guru

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

1 ACCEPTED SOLUTION

rajeevlochan82
Mega Guru

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);


View solution in original post

8 REPLIES 8

Thanks Doug.



I already have implemented the script solution to create a link to attachment but was looking some alternative to have embedded document. There may be possibility that users do not have ServiceNow accounts , so the link option will not work in that case. I will keep updated if I find alternate solution...


Community Alums
Not applicable

Hi Rajeev,



Even we are looking to embed the document in the mail. Were you able to find any solution to this issue ?



Thanks,


Mohammed Zeeshan


Anil74
Tera Guru

Hi Rajeev,



In the notification go to advanced view there you will find Include attachments field and select that field then system will send attachments along with the email.


rajeevlochan82
Mega Guru

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);