Previously I had written same blog post and it was working fine before Winter 16. However, after Winter 16 critical update was released by Salesforce to consider getContent() method as a callout. If this update is enabled in your Salesforce instance then my previous blog post will not work.

In this blog post, we will go through alternate design, where we would still be able to send Visualforce page content as an Email attachment. Difference is, instead of Apex Trigger , Invocable Method and Process builder will help us getting there.

Again, consider below simple Visualforce page, which we want to send as an attachment.

Last but not the least, we need to create a process builder and invoke above method in same situation, Trigger could have executed it. We can always use some hidden fields in trigger and populate for Process builder so that decision making would be easy.

Don’t forget to leave your comments and feedback for other possible designs or suggestions.

Hi ,
I have a requirement like this ,I have a custom object which related to account,opportunity when a value of a field in custom object is changed from one to another i need to send an email with pdf as attachment.

Hi jitendra..
Thank you very much for you tremendous effort in sharing the knowledge with us.
Actually I refered your above code for my requirement.

My requirement is that I wanted to attach the Pdf of the invoice for the booking record. Works fine and and also the PDF gets attached and sent but the major Problem is “THE PDF COMES OUT TO BE BLANK” nothings is displayed in it.

I also assigned the respective permissions and access to it but still the error persists..!!!
could you please help me..!!