I have a process builder which sends emails and also creates task etc .. So I have to save the email to the task or account object for future reference as a PDF(saving as a link to task based on taskid, will update the link each time the email goes out in Process builder).
I have created a VF page which is the exactly the same copy of the email going out from salesforce with merge fields from account and user objects. and created a custom link on task object , passing accountid, taskid, userid etc into the url to maintain uniqueness.
Below is the template for the email with merge fields i'm unable to display on the VF page:
{!Today}
{!Account.Name}
VF Code:
<apex:page standardController="Account" renderAs="pdf" applyBodyTag="false">
<apex:image id="logo" value="{!$Resource.Logo}" width="400" height="200"/>
<apex:pageBlock >
<p> Dear Sir/Madam, </p>
{!Today}
{!Account.Name}
<p>Thank you for your cooperation in this matter. If you should have any questions please contact {!$User.FirstName} {!$User.LastName} at {!$User.Phone}.</p>
<p>Sincerely,</p>
</apex:pageBlock>
</apex:page>
this is the URL on task object :
https://ABC.force.com/apex/RecordRequest?taskid={!Task.Id}?accountid={!Account.Id}?contactid={!Contact.Id}?userid={!User.Id}+{!Today}
TIA