2

I have a requirement where i have to use Visual force Email template.so, i have created a vf email template.Now i want to get that vf email body in apex controller.i now if i use custom HTML template i can get body.but my requirement is VF email template.

EmailTemplate template = [Select id,HtmlValue,Body from EmailTemplate where name =:'testEmail' limit 1];  
system.debug('##template##'+template);
string hbody=template.HtmlValue;
system.debug('##hbody##'+hbody);

Result

EmailTemplate:{Id=00Xf0000000M7mQEAS, HtmlValue=null, Body=null}
hbody null

Here am getting null values. Can any one please help me on this?

3
  • does this help? salesforce.stackexchange.com/q/13/2602
    – cropredy
    May 26, 2016 at 4:08
  • Hi Cropredy, Thanks for replay.with above link i can get body.But i want to replace merge fields which are present in vf page.can u help me .
    – vishnu
    May 26, 2016 at 4:57
  • Vishnu -- you're going to have to expand your question edit with more details as I'm afraid it is unclear
    – cropredy
    May 26, 2016 at 13:39

1 Answer 1

0

The Markup field on the EmailTemplate object will give you the Visualforce markup, HTML, JavaScript, or any other Web-enabled code that defines the content of the template.

Email Template Docs

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .