+ Start a Discussion
Chitral ChaddaChitral Chadda 

Visualforce Email tempalate

In visualforce email template is is it necessary that for customer controller it must contains component.
suppose in this
Dear {!lead.Name}
Thank you for choosing {!relatedTo.Account.Name} to assist you with your property taxes.  As we discussed over the 

phone, {!relatedto.Contact.Mobile__c} will be contacting you if we need additional information regarding your 

application. Their contact information, if you have any concerns or questions, is as follows:


now in all these dynamic fields like  eg used above {!relatedTo.Account.email}

is it necessary  that they all must be related to the "relatedToType" in the template...what if the dynamic field fields do not belong to the relatedToType object.

also, 1 thing more since we have either person or businees account  is this condition right to use
if it is business account then i want it shoul pick phone_1__c elase if business account then pick 'phone' field.

SonamSonam (Salesforce Developers) 
It would still work if the merge fields being used are not exactly of the object which is mentioned as the "relatedToType" in the template, however, the Object whose field you will use instaed should be linked through a relationship such as the sample shown in the link below;

relatedToType is Account, however, case fields are also used as case object have a relationship with Account