How do I attach a document to an email notification?

John VanBruggen
Giga Guru

To start this off, there are a lot of threads that ask this question.   To clarify, I do not want to attach an attachment from current record, thus that include attachments checkbox won't do the job for me.  

We are wanting to send a particular PDF document (it is a static pdf that does not change and contains a checklist that the users are to follow) as an attachment in an email, not as a link to an attachment file.   Since we are wanting to actually attach the record, this code will not work...

template.print ( 'Attachment: <a href="/sys_attachment.do?sys_id=' + gr. sys_id + '">' + gr. file_name + '</a>\n ' ) ;

...as it is a link and not an attachment.

So, to my question, if I know the sys_id of the attachment that I want to include in an email notification, is there a mail script that I can use that will attach that particular file to the notification so that it will be sent with the email?

Thanks in advance for any assistance in this.

Check out my Consultant's Survival Guide
https://youtube.com/watch?v=zYi8KhP9SUk
1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

You mentioned there are a lot of similar threads, but have you looked at this post - Sending Documents in an Email Notification   It would seem to be what you are looking for.

 

View solution in original post

6 REPLIES 6

jshafton21
Kilo Guru

What about running a business rule that attaches it to the notification before insert?



Edit: forgot to add the code


Using GlideSysAttachment.copy('sys_attachment', sys_id of attachment, 'sys_email', current.sys_id) should work


Jim Coyne
Kilo Patron

You mentioned there are a lot of similar threads, but have you looked at this post - Sending Documents in an Email Notification   It would seem to be what you are looking for.

 

Jim, I believe that you are correct.   We will give this a shot and I will update this with my findings.   Thanks!


Check out my Consultant's Survival Guide
https://youtube.com/watch?v=zYi8KhP9SUk

Thank you sir.   This was exactly what I needed.


Check out my Consultant's Survival Guide
https://youtube.com/watch?v=zYi8KhP9SUk