How to Export Salesforce Metadata Using Workbench
Creating a comprehensive backup of your Salesforce metadata is crucial for maintaining and managing your org. Today, we'll walk through the process of using Workbench to export your metadata. Follow these steps:
- Copy the below XML or create your own using Salesforce's Metadata API
- Save that xml snippet locally on your machine with whatever name you choose with the .xml extension
- Go to workbench.developerforce.com and log in with your Salesforce credentials.
- Once logged in, navigate to "Migration" > "Retrieve" in the top menu.
- Select the checkbox for Single Package
- Click Next and then finally Retrieve
- Then you can Download ZIP File and you're done!
Note: While this guide provides a simple approach to retrieving metadata for your Salesforce org, there are several other methods available for backing up your configurations, such as using repositories, continuous integration systems, and more.
This package.xml file includes a wide range of metadata types, from Apex classes and triggers to custom objects, fields, and even more specialized components like flows and permission sets. The asterisk (*) for each type indicates that all components of that type should be included in the backup.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexComponent</name>
</types>
<types>
<members>*</members>
<name>ApexPage</name>
</types>
<types>
<members>*</members>
<name>ApexTrigger</name>
</types>
<types>
<members>*</members>
<name>AuraDefinitionBundle</name>
</types>
<types>
<members>*</members>
<name>LightningComponentBundle</name>
</types>
<types>
<members>*</members>
<name>CustomObject</name>
</types>
<types>
<members>*</members>
<name>CustomField</name>
</types>
<types>
<members>*</members>
<name>Layout</name>
</types>
<types>
<members>*</members>
<name>Flow</name>
</types>
<types>
<members>*</members>
<name>WorkflowRule</name>
</types>
<types>
<members>*</members>
<name>Profile</name>
</types>
<types>
<members>*</members>
<name>PermissionSet</name>
</types>
<version>60.0</version>
</Package>