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:


Sponsored by Salto

CPQ Deployments, CI/CD, Impact analysis, and more

30-day free trial here

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

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!

All your salesforce metadata in the XML file

The next step is simply 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:

Build Your Own CI/CD Pipeline in Salesforce (Using GitHub Actions) | Salesforce Ben
Learn how to create your own CI/CD pipeline (using GitHub actions) in Salesforce with this comprehensive tutorial.

Subscribe to become a Salesforce API and CI/CD expert
fullstackdev@pro.com
Subscribe