How to export current metadata from a Salesforce org

Picture this – you're on a ship, sailing the seas of data. You're the captain of your ship, and you've got a Salesforce org as your ship. Now, as any good captain knows, you need to keep track of your crew's movements and actions. That's where metadata comes in.

  • Published 21 Apr 2023
  • 7 mins read
How to export current metadata from a Salesforce org
Table of contents
Article Summary Box

Article Highlights

  • Exporting metadata from a Salesforce org serves as a reliable backup for restoring the environment in case of data loss or corruption1.
  • It facilitates the migration of changes between environments and the deployment of new features and updates to production environments.
  • Provides visibility into the org’s structure and dependencies, enhancing management and optimization, and supports collaboration among team members.

Think of metadata as the ship's logbook. It records everything on board – who did what, where they went, what they saw, and so on.

Now, if you don't export your metadata regularly, you're essentially throwing away your logbook. And without that logbook, you're sailing blind.

If you want to avoid getting lost in the data sea, you need to export your metadata. That way, you can always refer to your logbook and make sure your crew is doing what they should.  Some of the benefits of exporting current metadata from a Salesforce org include:

Backup and recovery

Exporting metadata provides a reliable backup of your Salesforce org's current configuration, which can be used to restore the environment in case of data loss or corruption.

Migration and deployment

It can migrate changes between environments or deploy new features and updates to production environments.

Visibility and insight

Exported metadata can provide insight into the structure and dependencies of your Salesforce org, enabling better management and optimization of your environment.


Exporting metadata can facilitate collaboration between developers and stakeholders, enabling them to review and discuss changes to metadata and ensure consistency across different environments.

Compliance and auditing

Exported metadata can be used for compliance and auditing purposes, providing a record of changes made to the environment over time.

So, loosen your sails and easily discover how to export current metadata from a Salesforce org.

Step One: open VS Code with SFDX extensions installed

Image Source: VS Code

Ensure you have Visual Studio (VS) Code installed with the Salesforce DX (SFDX) extension.

Step Two: create a new project folder

Image Source: VS Code
  • Click on “Control-Shift-P” on Windows or “Command-Shift-P” on Mac
  • Run the command: “SFDX: Create Project With Manifest”
  • Select “Standard”
  • Choose a name for the project folder and place it in your preferred location.

Step Three: authenticate your org

Image Source: VS Code
  • Hit “Control-Shift-P” “ on Windows or “Command-Shift-P” on Mac
  • Run “Command: SFDX: Authorize An Org”
  • Choose “Production” for production orgs. Select “Sandbox” for sandbox orgs
  • Create a name for the org, or you can accept the default name
  • Enter your details into the org
  • Grant access to “Salesforce CLI.”

Step Four: retrieve your metadata

Image Source: VS Code
  • Click on the cloud icon, “Org Browser,” in VS Code
  • If necessary, click on the “Refresh” icon
  • Select the metadata type you want to retrieve. For example, an Apex class
  • Click on the smaller cloud icon located next to your metadata type
  • If you get an error message – relaunch VS Code
  • Go back to the “File Explorer”
  • You can edit the metadata locally
  • Switch back to the org by right-clicking the component. Select “SFDX: Deploy Source To Org.”

It’s smooth sailing from here

Exporting current metadata may sound tedious, but it can provide exciting benefits. From reliable backups to migration and deployment, metadata exports are a lifesaver in case of data loss or corruption.

It can also give you the insight and visibility you need to optimize your environment and collaborate like a pro with other team members.

With compliance and auditing in mind, you can rest easy knowing your data is in good hands.

So, don't hesitate to export your metadata and unlock the full potential of your Salesforce development projects.

a scratch org pool

Spring Release Notes Box
Spring Release Updates
MFA Enforcement
Multi-factor authentication (MFA) will be turned on by default starting April 2024 to enhance security.
Performance Improvements
Users will experience improved performance on more record home pages.
Salesforce Scheduler
There are optimizations for resource management and appointment scheduling.
Einstein Search
New features like Einstein Search Answers and customizable search experiences are introduced.

Last updated: 13 Jun 2024