Skip to main content
Brian Sherman (CAPREIT LP) 님이 #Visualforce에 질문했습니다
Hi there!

I have a VF email template that will populate all merge fields when I test from the template, but when workflow triggers the template, almost all merge fields are blank.

Here is the template:

 

<messaging:emailTemplate subject="{!if(RelatedTo.Site__r.State_Province__c='QC','Demande de location reçue – no de demande: ' & relatedTo.Name & ' ID: '& relatedTo.ID,'Viewing Requested: ' & 'Rental Inquiry: ' & relatedTo.Name & ' Inquiry ID: ' & relatedTo.ID)}" recipientType="Lead" relatedToType="Lead_To_Site_Association__c" replyTo="deleted for privacy">

<messaging:htmlEmailBody >

<html>

<body style="background-color:⌗ffffff;">

<apex:image id="Logo" value="{!If(relatedTo.Site__r.Company__r.Name=="ACME", "testurl1","testurl2")}" />

<apex:outputPanel rendered="{!CONTAINS(relatedTo.Site__r.State_Province__c,'QC')}" layout="block">

<table style="width:100%;border-top:5px solid ⌗872435;border-bottom:0px solid ⌗872435; background-color:⌗ffffff; padding: 0px 10px;">

<tr><td>

<p><strong>For English content scroll down.</strong></p>

<p>French text,</p>

</td>

</tr>

<tr style="padding-top:20px;">

<td><strong>Nom</strong>: {!relatedTo.Lead__r.Name}</td>

</tr>

<tr>

<td><strong>Courriel du client</strong>: {!relatedTo.Lead__r.Email}</td>

</tr>

<tr>

<td><strong>Téléphone</strong>: {!relatedTo.Lead__r.Phone}</td>

</tr>

<tr style="padding-bottom:20px;">

<td><strong>Date/heure</strong>: {!relatedTo.Viewing_Prefered_Date_Time_String__c}</td>

</tr>

<tr>

<td>

<br></br>

Sincères salutations,

<br></br>

Service à la clientèle<br></br>

<br></br>

</td></tr>

</table>

</apex:outputPanel>

<table style="width:100%;border-top:5px solid ⌗872435;border-bottom:5px solid ⌗872435; background-color:⌗ffffff; padding: 0px 10px;">

<tr>

<td>

<br></br>

<p>Hello,</p>

<p>{!relatedTo.Site__r.Name}. text removed</p>

<p>The original email appears below.</p>

</td>

</tr>

<tr style="padding-top:20px;">

<td><strong>Name</strong>: {!relatedTo.Lead__r.Name}</td>

</tr>

<tr>

<td><strong>Prospect Email</strong>: {!relatedTo.Lead__r.Email}</td>

</tr>

<tr>

<td><strong>Phone Number</strong>: {!relatedTo.Lead__r.Phone}</td>

</tr>

<tr style="padding-bottom:20px;">

<td><strong>Date/Time</strong>: {!relatedTo.Viewing_Prefered_Date_Time_String__c}</td>

</tr>

<tr>

<td>

<br></br>

Regards,

<br></br>

Customer Care<br></br>

<br></br>

</td>

</tr>

<p>

<p>Original Email Content:</p>

<p>{!relatedTo.Original_Email__c}</p>

</p>

</table>

</body>

</html>

</messaging:htmlEmailBody>

</messaging:emailTemplate>

The only fields that merge when sent from workflow are:

{!relatedTo.Viewing_Prefered_Date_Time_String__c}

{!relatedTo.Site__r.Name}

All other fields do not merge.  This template is being sent to a Lead and a Contact/Person Account.  Any ideas?
답변 2개
  1. 2016년 9월 7일 오후 2:02
    Hi,

    Did you resolve this?

    I have a similar issue where it's working perfectly in the Sandbox but in the live org it's not populating the relatedTo.Name field

    Thanks