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

Visualforce email template dynamic pdf attachments

Hi i have a couple of pdfs to attach but i want to have one template and depending on a criteria can i have these attached?

You can have multiple attchments using


<messaging:attachment renderAs="pdf" filename="abc"> </messaging:attachment> <messaging:attachment renderAs="pdf" filename="def"> </messaging:attachment>




based on condition make it rendered true / false

Message Edited by visualforce_dev on 08-04-2009 02:48 AM
but how would i attach existing pdf documents i.e. i have some pdf files in a directory i don't want to code this in the template from scratch?

You can't currently include stored documents in a Visualforce email template. Instead, you would need to use Messaging.sendEmail to attach files stored in Salesforce. You can access this feature in triggers, and you can modify the workflow rule to trigger the trigger by using a field update. If you're manually sending an email, you'd have to literally write your own SendEmail page in order to dynamically add the attachments. I would say that your best option would be to re-create the PDF in an apex: attachment tag.