Print this page

Exporting Email Templates

Knowledge Article Number 000231392

Export Email Templates

Available in: both Salesforce Classic and Lightning Experience
Available in:
• Enterprise
• Performance
• Unlimited
• Developer
To export records:
• “Read” on the records
To export all records:
• “Read” on the records
Resolution You can use the Apex Data Loader Export function to extract Email Templates from Salesforce. When you export, you can choose to include (Export All) or exclude (Export) soft-deleted records.
1. Open the Data Loader.
2. Click Export or Export All. These commands can also be found in the File menu.
3. Enter your Salesforce username and password. Click Log in. After your login completes successfully, click Next
If your organization restricts IP addresses, logins from untrusted IPs are blocked until they’re activated. Salesforce automatically sends you an activation email that you can use to log in. The email contains a security token that you must add to the end of your password.
For example, if your password is mypassword, and your security token is XXXXXXXXXX, you must enter mypasswordXXXXXXXXXX to log in. 
4. Choose EmailTemplate table name in list of objects.  If your object name does not display in the default list, check Show all objects to see a complete list of objects that you can access. The objects will be listed by localized label name, with developer name noted in parentheses. 
5. Click Browse... to select the CSV file to which the data will be exported. You can enter a new file name to create a new file or choose an existing file. If you select an existing file, the contents of that file are replaced. Click Yes to confirm this action, or click No to choose another file.
6. Click Next.
 7. Create a SOQL query for the data export. For example, check Id and Name in the query fields and click Finish. As you follow the next steps, you will see that the CSV viewer displays all the Account names and their IDs. SOQL is the Salesforce Object Query Language that allows you to construct simple but powerful query strings. Similar to the SELECT command in SQL, SOQL allows you to specify the source object, a list of fields to retrieve, and conditions for selecting rows in the source object.
a. Choose the fields you want to export.
b. Optionally, select conditions to filter your data set. If you do not select any conditions, all the data to which you have read access will be returned.
c. Review the generated query and edit if necessary.
Tip: You can use a SOQL relationship query to include fields from a related object. 
For example:
Select Name, Pricebook2Id, Pricebook2.Name, Product2Id, Product2.ProductCode FROM PricebookEntry WHERE IsActive = true
Select Id, LastName, Account.Name FROM Contact

When using relationship queries in Data Loader, the fully specified field names are case-sensitive. For example, using ACCOUNT.NAME instead of Account.Name does not work.

Data Loader doesn’t support nested queries or querying child objects. For example, queries similar to the following return an error:
SELECT Amount, Id, Name, (SELECT Quantity, ListPrice, PriceBookEntry.UnitPrice, PricebookEntry.Name, PricebookEntry.product2.Family FROM OpportunityLineItems) FROM Opportunity

Also, Data Loader doesn’t support queries that make use of polymorphic relationships. For example, the following query results in an error:
SELECT Id, Owner.Name, Owner.Type, Owner.Id, Subject FROM Case 

For more information on SOQL, see the SOQL and SOSL Reference.

8. Click Finish, then click Yes to confirm.
9. A progress information window reports the status of the operation.
10. After the operation completes, a confirmation window summarizes your results. Click View Extraction to view the CSV file, or click
OK to close. 

• If you select compound fields for export in the Data Loader, they cause error messages. To export values, use individual field components

promote demote