How to retrieve your entire Salesforce metadata with 2 commands
One of the first steps in implementing CI/CD for Salesforce is storing your Salesforce metadata in a Git repository.
Recently I learned about a newish sfdx
command that allows you to retrieve all the metadata in the org without having to know beforehand what metadata types you have, which fields to include, etc.
Thanks to Alba Rivas for this information, which was provided in this Developer Quick Take:
Steps
First, we'll run a command to generate a package.xml
file that includes every single metadata item in your org
sfdx force source manifest create --fromorg [your org alias] --manifestname=allMetadata --outputdir manifest
Or if you are using the newer commands
sf project generate manifest --output-dir manifest --name=allMetadata --from-org [your org alias]
Once you run this command, you'll see allMetadata.xml
file under the manifest
directory:
You'll notice this file lists all the metadata in your org!
The next step is very simple. All you have to do
is to right-click the file, and select "Retrieve source in manifest from Org"
And that's it! Now all your Salesforce metadata is in the sfdx project.
The next steps are uploading this to GitHub and configuring the pipeline. You can find steps for this in the following article: