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
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:

{!relatedTo.Account.email}



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;
https://www.salesforce.com/us/developer/docs/pages/Content/pages_email_templates_creating.htm

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