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
Liz MalmanLiz Malman 

Visualforce Email Template Merging Related Object Field

Hi all,

I have a visualforce email template related to one object, Events. Related to Events is an object called Teams. I'm trying to get a field from the Teams object into the template. How do I call this field?

Code:
<messaging:emailTemplate subject="PREFERRED TRAVEL NEEDED || {!relatedTo.Events__r.Name}" recipientType="User" relatedToType="Teams__c">
<messaging:htmlEmailBody >

<apex:outputLink value="http://smt.force.com/?#/details/{!relatedTo.Events__r.Id}">Submit Travel for {!relatedTo.Engineer__r.Name}</apex:outputLink> <br/> <br/>

<b>Event: </b>{!relatedTo.Events__r.Name} <br/>
<b>Account: </b>{!relatedTo.Events__r.accountLookup__c}<br/>

I'd like to call this other field right below Account.