function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jwljwl 

Getting a field to show up on an email template

Hello,

 

I think this should be really simple, but it is driving me nuts.

 

I created a custom field called "QuoteContact" which I placed on the opportunity page layout.  It is a lookup field that points to contacts associated with the Account for which the opportunity belongs.   This works fine.   What I am having trouble with is getting this value to show up on an email template (I am using SFDCs simple quote app template). 

 

The weird thing is I have a formula custom field (called email_address_for_quote) that displays the email associated with the quote contact that I can display on the template using the following: 

{!relatedTo.Email_Address_for_Quote__c}

 

I tried using {!relatedTo.QuoteContact__c} in the template, but while the template accepts the code, it does not deliver the expected results.  It displays "003T000000JNdECIA1" instead of the name of the contact.

 

I am guessing there is something I need to do differently to reference a lookup field in template.  Does anyone know?

 

Thankss!

Best Answer chosen by Admin (Salesforce Developers) 
jwljwl

Someone sent me the following that worked beautifully:

 

<apex:outputText value="{!relatedTo.QuoteContact__r.firstName} "/>

<apex:outputText value="{!relatedTo.QuoteContact__r.lastName}"/>

 

Problem Solved!

All Answers

lvivaninlvivanin
similar case working fine with me in my e-mail template:
 
{!Contact.Master_Object__c}  - gives Master Object Name (e.g. A-0021 )

{!Contact.Master_ObjectId__c}  - gives Master Object (e.g. a0B40000001kUqP )
jwljwl

Someone sent me the following that worked beautifully:

 

<apex:outputText value="{!relatedTo.QuoteContact__r.firstName} "/>

<apex:outputText value="{!relatedTo.QuoteContact__r.lastName}"/>

 

Problem Solved!

This was selected as the best answer