function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ben Merton 15Ben Merton 15 

Send email and pdf attachment?

I have a custom button that generates a PDF HTML page for Invoicing using a controller with queries.

At the moment, the user has to wait for approval and then press the PDF button , then save this to the 'Downloads' on the hard drive, then 'Send and Email', then click 'Template', then attach the saved PDF, then find the BCC people etc etc.  This is a pain.

It would be much better if this was automatically sent on approval to all the Contacts defined to receive Invoices.

What methodology should I use for attaching a PDF to an email and sending it?
Best Answer chosen by Ben Merton 15
Krishna SambarajuKrishna Sambaraju
You can build an after update trigger on the object that is approved. In that trigger you can send email with the attachment. 
Below is a link that details on sending email with attachment.
http://blog.jeffdouglas.com/2010/07/16/create-and-email-a-pdf-with-salesforce-com/
You can implement the same through a trigger to automate it.

Hope this helps.