A project I'm working on is winding down but may be revived again in two or three years. I need to archive all of the project metadata, including apex, lightning components, workflow rules, process flows and email templates outside of Salesforce as no Salesforce licenses will be preserved. I looked at creating an unmanaged package but there doesn't appear to be a way to download them locally. Is there a standard practice for archiving an org's metadata or should I just download everything in VSCode and zip it into a single file?
2 Answers
If you added all the metadata to the unmanaged package you can extract all of its content using the workbench as a zip file.
To do so here are the steps
- Log into the workbench(https://workbench.developerforce.com) using your salesforce login credentials
- Navigate to metadata retrieve page (https://workbench.developerforce.com/metadataRetrieve.php)
Enter the package name in the package names and click single package checkbox and you will get a zip folder.
The zip folder can be securely stored and in future if you need to restore you can deploy the same using workbench in your org.
I ended up doing this a different way, mainly because of the time required to create an unmanaged package with thousands of items.
First, I used the packagebuilder tool on Heroku to get the package.xml for my entire org.
Second, I downloaded all of the metadata using the following Salesforce DX command with the manifest I generated:
sfdx force:mdapi:retrieve -r archive -u full_sandbox -k metadata/package.xml
You can also use the package.xml file to download all of your metadata from VSCode. The advantage of this workflow is that it's then very easy to uploaded all of the metadata to a Github repository, which is ultimately what I need to do as an archiving strategy.