0

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

0

1 Answer 1

3

For this visualforce page, you need to pass the AccountId as URL parameter.

Since you have defined standardController="Account" in the page attribute, so it should expect accountId as value and id as key

https://ABC.force.com/apex/RecordRequest?id={!Account.Id}

And {!$User.FirstName}, {!$User.LastName}, {!$User.Phone} will be taken from logged-in user's attribute values.

This is corrected VFP. You have wrongly defined today's function.

<apex:page standardController="Account" renderAs="pdf" applyBodyTag="false">

    <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>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .