Before we do work in an org, we take a metadata backup of the org to give us a moment-in-time copy of the metadata. As we move forward with the project, having completed this step allows us to revert our changes back to that exact moment as well as see what may have changed in the org since. There are a few different ways to perform these backups:
- From Workbench
- With Sublime Text and MavensMate
- With Eclipse and Force.com IDE
In today’s post, I’ll focus on giving you step-by-step instructions for completing a metadata backup from Workbench.
How to Pull Metadata Backup From Workbench: Your First Move
Package.xml Manifest File
First things first: you’ll need to have a package.xml file in order to pull your metadata backup from Workbench. You can use this Heroku app to generate your package.xml file: https://packagebuilder.herokuapp.com/. And for more information on package.xml files, and why they’re so important, here’s a helpful Salesforce link: https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/daas_package.htm.
The screenshot above is an example of some of the components you could retrieve using API version 34.0. (Don’t forget–all orgs were upgraded to Summer ‘16 this month, making the most recent version 37.0.)
The package.xml file can be used to retrieve records for all types of metadata in Salesforce. If there are no records for a specific metadata type, the retrieve will still pass, it just will not include those metadata types with no results.
Note: You cannot use an asterisk wild card to work with all standard objects; each standard object must be specified by name.
In addition to the Heroku app I list above, there are other options out there to help you get a list of your metadata, like Sublime Text and Mavensmate, or this Salesforce Toolkit. Apps like these will help you generate a full or partial package.xml file, depending on your needs.
Now keep that package.xml file handy as you follow these step-by-step instructions for completing a metadata backup from Workbench–you’re going to need it.
How to Pull Metadata Backup From Workbench: Step-by-Step Instructions
- Navigate to workbench.developerforce.com.
- Choose the environment:
- Production – used for production environments as well as developer environments
- Sandbox – used for all types of sandbox environments
- Choose the API version that matches the version for which you generated your package.xml file:
- 37.0 – this is the current version of Salesforce, Summer ‘16
- 36.0 – Spring ‘16
- 35.0 – Winter ‘16
- 34.0 – Summer ‘15
- 33.0, etc. – each release of Salesforce has a different API version
- Check “I agree to the terms of service.”
- Click “Login with Salesforce”
- Enter the username and password for the environment
Note: If you’re currently logged into Salesforce in the same browser in which you have Workbench open, you can skip to the next step. Log out of other orgs if you do not want to use Workbench with them, or open Workbench in another browser.
- Enter the username and password for the environment
- Navigate to the “Retrieve” UI
- In the “Jump To” picklist, choose “Retrieve” and click “Select”
- In the Migration menu in the nav bar, click “Retrieve”
- For “Unpackaged Manifest,” choose your package.xml file (as discussed above)
- Leave “Package Names” empty
- Leave “Single Package” false
- Click “Next”
- Once you have successfully staged the request, click “Retrieve”
- Review and download results
Note: The page will continue to refresh until the request passes or fails.
- Results at the bottom of the page give you information on your retrieve request:
Done – this will be true when the results are ready
ID – this is the ID of the operation that was performed
Status – this will be “succeeded” or “failed,” based on the operation results
Success – this will be true if the retrieve is done, succeeded, and the manifest file successfully pulled down the metadata into a zip file
FileProperties – these are all of the metadata components that were pulled with the retrieve; you can preview them before you download the file
Messages – these messages give you insight into the retrieve operations results; e.g., some metadata types may not exist in the API version chosen, may not have any components to retrieve, or may not be available in the environment that you are pulling
- When the retrieve passes, a zip file will be ready for download; click “Download Zip File” to get your backup
Are you new to using Workbench for metadata backup? Let us know how it goes in the comments here or via Twitter. And for more information on using Workbench, be sure to check out this blog post from Tom. I hope you’ll find this guide helpful!