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
NCEE_AndrewNCEE_Andrew 

Easy Email question

I'm working on a visualforce email template.  I'm having a problem pulling the account name.  Here's what I tried:

 

 

<messaging:emailTemplate subject="Send Catalog" recipientType="User" relatedToType="Contact"> <messaging:plainTextEmailBody >

...

 

Name: {!relatedTo.Name} Email: {!relatedTo.Email} Title: {!relatedTo.Title} School: {!relatedTo.Account__r.Name} Street: {!relatedTo.MailingStreet} City/State/Zip: {!relatedTo.MailingCity}, {!relatedTo.MailingState} {!relatedTo.MailingPostalCode}

 

...

 

</messaging:plainTextEmailBody> </messaging:emailTemplate>

 I'm having problems here:

School: {!relatedTo.Account__r.Name}

 

 Anyone know how to pull the account name when recipientType="User" relatedToType="Contact"?

 

Best Answer chosen by Admin (Salesforce Developers) 
aalbertaalbert

Try this:

 

School: {!relatedTo.Account.Name}

 

 For relationships between standard objects, there is no "__r" in the relationship name.

 

 

All Answers

aalbertaalbert

Try this:

 

School: {!relatedTo.Account.Name}

 

 For relationships between standard objects, there is no "__r" in the relationship name.

 

 

This was selected as the best answer
NCEE_AndrewNCEE_Andrew
Thanks, works like a charm.