Force.com Migration Tool : Email Templates
-
01-03-2021 - |
문제
I am looking to retrieve all email templates using Force.com ant migration tool. I believe we can not have bulk retrieve for Email Templates, Reports etc.
Is there any way we can retrieve all email templates in one go without specifying each template name? I believe we can some custom implementation using Metadata API, but wondering if someone has already implemented custom ant task for it.
Thanks in advance.
해결책
Email Templates, Reports etc. are in folders, so you must provide the containingFolder
attribute to the sf:bulkRetrieve
task and you'll get back all the items in that folder. For example:
<sf:bulkRetrieve
username="${sf.username}"
password="${sf.password}"
serverurl="${sf.serverurl}"
retrieveTarget="retrieveUnpackaged"
metadataType="EmailTemplate"
containingFolder="SalesTemplates"
/>
To find the folder names themselves, you can query the Folder
object and filter on the Type
column for the metadata type you are interested in. For example:
SELECT DeveloperName FROM Folder WHERE Type = 'Email'
다른 팁
Have you tried having the following in your mainfest file.? It should retrieve all the Email Templates:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>EmailTemplate</name>
</types>
<version>23.0</version>
</Package>
If you have the folder/ template names, you can deploy individually, just not using wildcards.
(You could probably script out the member list and construct a dynamic .xml build file)
<types>
<members>Simple_Survey</members>
<members>Simple_Survey/Alert_Managers_NPS_Survey_Created</members>
<name>EmailTemplate</name>
</types>