Attach a Dynamic PDF Message to a Salesforce Email Template.

The Email Template can be used in Email Alerts that will be triggered by Workflow Rule / Process / Flow … etc

We will create following items:

  1. A Visualforce page that will be rendered as PDF. (e.g. Receipt)
  2. A Apex Controller Class for the above VF page. (e.g. ReceiptController)
  3. A VF Component that to be referenced by the Visualforce Email Template. (e.g. ReceiptAttachment)
  4. A Apex Controller Class for the above VF Component. (e.g. ReceiptAttachmentController)
  5. An Visualforce Email Template.

Sample Code List:




Visualforce Email Template


Now you will see “Visualforce Attachments” in the Email Template, File Name: receipt.pdf


Leave a Reply

Your e-mail address will not be published. Required fields are marked *