I am trying to generate a command or set of command that will retrieve all my email templates.
I am using sfdx and do not want to use ant or package.xml
This post only talks about getting a specific email template, I want a method to get all of them.
Is that that possible?
If not – what is the preferred way on doing that?
Best Answer
Unlike other metadata types
EmailTemplate
metadata type does not support a wild character.Also, it will need you to specify the folder name as well to retrieve the metadata.
It will be some manual work unless you script it using Bash or Node.js,
Here is how I would approach manually,
Step 1
Create a SOQL to get all the folder names of Type Email
Step 2
For every folder in step1, note down the
developername
and use the below command.Step 3
From the output
JSON
look for the fieldfullName
to construct a package.xml like belowRetrieve using package.xml using the
mdapi
Alternatively
sfdx force:source:retrieve -m "EmailTemplate:<folderdevelopername>:<templatedevelopername>"
for n times.