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
Guyver118Guyver118 

Visualforce email template child to parent?

Hi i have this relationship master/detail:-

 

Online Application:Parent

Applicant: Child

 

Now what i want to do is basically whenever an applicant is created is send an email using a visualforce email template i need to do some dynamic stuff :0

 

now the problem is how do i access the online applicaton fields from the applicant i.e. 

 

<messaging:emailTemplate recipientType="Contact" relatedToType="Applicant__c"
 subject="Thank you for your Application!">

 

 

how do i access the applicant's online application details

also as this will be sent via a workflow to the applicant's email what do i put in  recipientType?

Best Answer chosen by Admin (Salesforce Developers) 
TehNrdTehNrd

This works for pulling Account info from a contact email:

 

 

<messaging:emailTemplate subject="test" relatedToType="Contact" > <messaging:plainTextEmailBody > {!relatedTo.Account.Name}

 

 For you this should work:

 

 

{!relatedTo.online_application__r.field}

 

 

 

 

All Answers

TehNrdTehNrd
I think recipientType isn't required if it is being sent with workflow but don't hold me to that one. To reference the parent fields use this syntax, {!relatedTo.somefield}.
Message Edited by TehNrd on 07-29-2009 11:28 AM
Guyver118Guyver118
hmm what i am trying to do is access the parent object from applicant i.e applicant__c.online_application__r.field ???
TehNrdTehNrd

This works for pulling Account info from a contact email:

 

 

<messaging:emailTemplate subject="test" relatedToType="Contact" > <messaging:plainTextEmailBody > {!relatedTo.Account.Name}

 

 For you this should work:

 

 

{!relatedTo.online_application__r.field}

 

 

 

 

This was selected as the best answer