I need to convert 200 classic emailtemplates to lightning templates and I've encountered an obstacle. When I insert templates with lightning markup using SOQL and identical field values to an existing lightning template, they are saved as classic emailtemplates, with a folder name of "Unfiled Public Classic Email Templates" even though the folder has the same ID as existing Lightning templates. If I save a template using the default lightning rich text email editor, it saves with the same folder id but is now identified as a Lightning emailtemmplate in folder "Public Email Templates" if I view it by id. The template identified as classic, with lightning markup, opens in the classic template editor. The template identified as lightning opens in the lightning template editor.

Comparison between two emailtemplates. The first row is classic and row two is lightning: enter image description here

There is only one difference that I can see between the two emailtemplate files. When I save an emailtemplate using the default lightning editor, salesforce appends an underscore and a number to the developerName as follows:


The process by which template types are differentiated doesn't apear to be documented anywhere. I would like know how to upload/insert an email template so that it saves as a lightning template and not a classic template.

Editor examples.

Note that the lightning emailtemplate record page includes a field called "related entity type." This isn't a documented field on emailtemplate and it's not derived from the lightning merge codes, because there isn't a merge code for lead in that example. Is there another object where a whatId for the emailTemplate is stored?

Lightning emailTemplate in lightning editor: enter image description here

Lighting emailtemplate salesforce identifies as classic: enter image description here

  • 2
    I think u might be missing setting up UIType=2 field when creating Template. check here - link
    – VarunC
    Commented Apr 16, 2019 at 9:29

1 Answer 1


The solution is to set TemplateType to 'custom' and UIType to 'SFX'. (Thanks very much to StackForce user VarunC for the helpful comment)

You must log in to answer this question.

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