I have been attempting to enter an Email Template for a couple of days now. Each time I create a Visualforce email template and fill out the required fields. I then enter the body of my email and click Save. When I query for the email template using the following query:

select id, htmlvalue, body, name from emailtemplate where name = 'emailTemplateNameHere'

the htmlvalue comes back as blank despite me using <messaging:htmlEmailBody> tags in my body.

I queried again this morning to make sure nothing had changed over the weekend and the HtmlValue was still blank. I entered another Email Template, re-queried to check if it had an HTML body and saw (since I used select id, htmlvalue, body, name from emailtemplate where name like '%partOfNameHere%') that the new record had a blank HtmlValue, but the HtmlValue for my new record was blank.

It is also important to mention that when I run code that attempts to select the HtmlValue it also gets a blank value. This has been preventing me from working on a project for a few days now, does anyone have any suggestions? Thanks ahead of time!

  • 1
    try querying for the markup field - see developer.salesforce.com/docs/atlas.en-us.object_reference.meta/…
    – cropredy
    Oct 19, 2015 at 17:24
  • The Markup field is present, but using that field appears to mess up the formatting. Is there a reason my email template content is there and not in the HtmlValue field?
    – Jessica
    Oct 19, 2015 at 23:40
  • Hmm -- when I did a query like you did against my entire library of emailTemplate - the ones of type html always had htmlValue but only some of my VF templates had values in htmlValue. 'markup` is present for all VF templates and never for html templates. Of course, this OP begs the question as to why you need to read the html? If you are trying to prerender the template, there are better ways
    – cropredy
    Oct 20, 2015 at 0:41

2 Answers 2


Hey Jessica I was facing the same issue, and I have figured out the solution.

In order to reflect the changes, please follow the steps:

  • you have to mark Available For Use as inactive in email template properties before making the changes.
  • Do your changes whatever you want to.
  • Once you are done with your changes you can mark Available For Use active again.

Bonus: Do your changes and once you are done with your changes, just switch Available For Use to inactive, and again marking it as active will do the job.

To verify your changes:

select Id, name,subject,body,htmlValue from EmailTemplate WHERE DeveloperName = 'Template_Developer_Name'

I think, you can do it like below

SELECT Id, Name, DeveloperName, Subject, Body, HtmlValue FROM EmailTemplate WHERE DeveloperName = 'Email_Template_Name_Here'

  • The issue here wasn't that the query was returning no results, but rather that the returned result had a null value for HtmlValue.
    – Derek F
    Aug 11, 2020 at 11:40

You must log in to answer this question.

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