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
Nuevo9763Nuevo9763 

Visual force Email Template

Hi all,
this is the first time I ma creating VF email Template.
I have tow custom objects in master detail relation. I have need to create Visual Force Email Template. In this template I need to reference fields from both master and detail objects. When creating VFtemplate in relatedToType I have specifies master object. 
Now in my custom controller which is also a controller for detail object VF page, I am adding method to retrive data for email template. I have already gotton the data part almost done. But I do not know how to use this in the template. Do I have to specify Ccontroller class anywhere in VF Email template? I am trying to see some example where the objects involved are both custon objects.
I also have question about how to use this template in code? as all email templates I used before were through workflow. But this email will be triggered manually on a button click. So is it that I will be writing amethod in the page controller to somehow access this template and use Apex to send Email?
If anyone can point me to some example that will be really helpful.
Thanks in advance,
​MK7