0

Looking to get Metadata for lightning email templates.

Here is what I have tried:

Retrieving from source the following package.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
        <members>AgentTemplates/TestTemplate</members>
<name>EmailTemplate</name>
</types>

<version>54.0</version>

</Package>

I have queried the EmailTemplate object and see no records related to my newly created Lightning Email templates.

I have looked at this related question: Metadata API - listmetadata() for EmailTemplates is empty

Which recommended the following:

MetadataService.ListMetadataQuery queryEmailFolder= new MetadataService.ListMetadataQuery();
// Define Folder Name ''
queryEmailFolder.folder = '';
// Set EmailFolder
queryEmailFolder.type_x = 'EmailFolder';
queries.add(queryEmailFolder);       
MetadataService.FileProperties[] fileProperties = service.listMetadata(queries, 30);

But it's not clear what the data type of queries is supposed to be?

I have read the article. https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_emailtemplate.htm

The only thing here I see is:

"Packaging isn’t supported for Lightning email templates"

Does this mean it's not possible to get the metadata for lightning email templates?

2 Answers 2

1

Developer Name of template was auto-generated:

Test_Template_1648487403164

Updated package.xml and was able to pull metadata:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
        <members>AgentTemplates/Test_Template_1648487403164</members>
        <name>EmailTemplate</name>
</types>

<version>54.0</version>

</Package>
1
  • You should mark your answer as "accepted" to benefit the Community
    – cropredy
    Commented Dec 28, 2023 at 18:16
0

It's not possible to retrieve "Lightning Email Templates", only "Classic" ones. Lightning Templates are seen as records, like Contact or Account, the Classic ones are seen as Metadata, that ones you can pull in your repo.

1
  • Although you can query for information about Lighting Email Templates using SOQL ("SELECT Id, Name, ParentId, DeveloperName FROM Folder" and "SELECT Id, Name, DeveloperName, FolderName FROM EmailTemplate"), you can retrieve them with a package.xml just like any other metadata, see the accepted answer.
    – mhenry1384
    Commented Dec 3 at 18:15

You must log in to answer this question.

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