I have looked through a number of different threads and haven't found any clear answers to populating a child object's value in the subject of a Visualforce Email Template.
I want to populate the Visualforce Email Template Subject line dynamically with the value of a custom object that is related to the "relatedToType" object. I have a custom component
and custom class
. Is there a way to pull the data from there to to subject? <messaging:emailTemplate subject="Legal Name - FWC#{!cr.Internal_MID__c} " recipientType="Contact" relatedToType="Opportunity">
? Credit_Review__c has a relationship to Opportunity but Opportunity does not have a relationship to Credit_Review__c.
public class BrokerDeclineEmailTemplate {
public Credit_Review__c cr {get;set;}
public Id controllerValue;
public void init(){
cr = [select Id, Opportunity__c, Internal_MID__c from Credit_Review__c WHERE Opportunity__c = :controllerValue ORDER BY CreatedDate DESC LIMIT 1];
Access parent object fields in VisualForce email template subject and VF Email Template are close but not exactly what I am looking for. Unless the only way to do it is with the URL....