You need to sign in to do that
Don't have an account?

Lookup field value shows as ID Number instead of text
Hello,
I am using the below email template to send an email to the primary contact of an opportunity once the opportunity has reached a certain stage. I added a contact lookup field to the Opportunity object so that the contact could be shown. The trouble is that when the email is sent, it doesn't send the contacts name rather the id
<messaging:emailTemplate subject="Equipment Order Confirmation" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center }
TD {font-size: 11px; font-face: verdana }
TABLE {border: solid #CCCCCC; border-width: 1}
TR {border: solid #CCCCCC; border-width: 1}
</STYLE>
<font face="arial" size="2">
<p>Dear {! Relatedto.Contact__c},</p>
<p>The following is a confirmation of your equipment order:</p>
<p/>
<p>Pickup Date: {! RelatedTo.Pick_Up_Date__c}</p>
<p>Return Date: {! RelatedTo.Return_Date__c}</p>
<p/>
<p>Pickup Location: {! RelatedTo.Pick_Up_Location__c}</p>
<table border="0" >
<tr >
<th>Item</th><th>Quantity</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
<tr>
<td>{!cx.pricebookentry.Product2.name}</td>
<td>{!cx.Quantity}</td>
</tr>
</apex:repeat>
</table>
</font>
</body>
</html>
</messaging:htmlEmailBody>
Here is an example of what was sent:
Dear 003C000001IDKYcIAP,
The following is a confirmation of your equipment order:
Pickup Date: Fri Feb 24 00:00:00 GMT 2012
Return Date: Tue Feb 28 00:00:00 GMT 2012
Pickup Location:
Item | Quantity |
AED Trainer (Generic) | 1.0 |
Kyle Manikin | 5.0 |
Bandage & CPR Training Kit | 10.0 |
Adult Annie Manikin | 5.0 |
Try this
{!RelatedTo.Contact__r.Name}
All Answers
Instead of using {!Relatedto.Contact__c}, try {!recipient.Name}
Try this
{!RelatedTo.Contact__r.Name}
Thanks New_Developer! That worked perfectly. How did you know to use _r instead of _c?
Nick