3

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:

developer_test_lightning_1555378645914

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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.