+ Start a Discussion

VF email template on custom object to include attachments from Notes & Attachments

I am new to Visualforce Email Templates so any help is greatly appreciated!  Thanks!


I have the following HTML email template that we currently use for our approval workflow from a custom object: Proposal__c



I would like to convert this template to a Visualforce email template because I need to add couple things to it:

1. List of attachments that are attached to the proposal record that is being approved - with a link to view the attachment or the attachment(s) embeded in the email itself

2. Proposal approval history if possible - we have multiple approval steps and it would be nice to include that info in the email



Can someone please help? Thank you in adance for your help!!!


Here's the current HTML email template:

Proposal Approval Request

Sales Rep: {!Proposal__c.Opportunity_Owner__c}

Expected Close Date: {!Proposal__c.Expected_Close_Date__c}

Pricing Type: {!Proposal__c.Pricing_Type__c}

Estimate Provider (SE/SA): {!Proposal__c.Estimate_Provider__c}

One Time Cost: {!Proposal__c.One_Time_Cost__c}

Annual Recurring Cost: {!Proposal__c.Minimum_Annual_Recurring_Price__c}

Minimum One Time Price: {!Proposal__c.Mimimum_One_Time_Price__c}

Commited Annual Reccuring Price: {!Proposal__c.Minimum_Annual_Recurring_Price__c}

Upsell Adoption & Usage Recurring Fees: {!Proposal__c.Upsell_Adoption_Usage_Recurring_Fees__c}

Submitted for Approval Date: {!Proposal__c.Submitted_for_Approval_Date__c}

Note to Approver: {!Proposal__c.Proposal_Comments__c}



To Approve/Reject the proposal please do one of the following steps:

1. Reply to this email with one of the following words in the first line of the email body. Optionally you can add comments in the second line.



2. Click here to approve in Salesforce.






1.to att attachment to the email template you can use:


 <messaging:attachment renderAs="PDF" filename="myFile.pdf">

<!-- All this will be as PDF attached to the email-->


2.To show the approval history I think you will need to query SF table.

You need to investigate on tables: processInstance and processInstanceWorkItem.