Deployment tools

How metadata moves from one org to another today: Metadata API, Salesforce CLI, change sets, Lifecycle Center, packages, and why not Ant Migration Tool.

A change is finished and tested in a sandbox: which tool takes it to production, and what has to be checked first? This page explains Metadata API, the common mechanism, and the tools that use it today. The local environment is covered in Development.

Metadata and Metadata API

Metadata is data that describes other data. In an org (a Salesforce organization) it describes the schema, processes, presentation, permissions and general configuration.

A metadata type defines a structure, such as CustomObject. A component is an instance of that type, such as the object MyCustomObject__c.

Metadata API is the API (application programming interface) that moves metadata between orgs. It does not work with records, which are data. Salesforce CLI and Salesforce Extensions for Visual Studio Code (VS Code) are built on top of it.

Its two central calls are retrieve(), which brings metadata from an org, and deploy(), which takes it to another. Both exchange a .zip file with the components in XML (Extensible Markup Language) and a manifest, package.xml.

The manifest

The manifest lists what is retrieved or deployed and with which API version. Each types block groups the components (members) of one type (name). A * asks for every component of that type.

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>MyCustomObject__c</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomTab</name>
    </types>
    <version>68.0</version>
</Package>

Metadata API follows the manifest, not the folders: what is not listed does not travel. One operation takes up to 10,000 files, with a .zip of 39 MB compressed or 600 MB uncompressed.

Deleting components

To delete, you deploy a destructive manifest, destructiveChanges.xml. It has the package.xml format, but does not accept *. A package.xml with the API version goes with it.

By default, deletions are processed before additions. destructiveChangesPre.xml and destructiveChangesPost.xml set whether deletion happens before or after. Order matters with dependencies: an object that an Apex class references is deleted after deploying the class without that reference.

Deleted components go to the Recycle Bin. The purgeOnDelete option removes them without it, but only in Developer Edition and sandboxes, never in production. A roll-up summary field deleted through Metadata API is always purged.

Salesforce CLI

Salesforce CLI (command-line interface) deploys from a local Salesforce DX (Developer Experience) project. These are its deployment commands:

Command What it does
sf project retrieve start Brings metadata from an org into the project.
sf project deploy start Deploys metadata from the project to an org.
sf project deploy validate Validates a deployment without saving it and returns a job ID.
sf project deploy quick Deploys a validated job without rerunning the tests.
sf project generate manifest Creates a package.xml or a destructive manifest.

What moves is chosen with a single flag (option): --manifest (a package.xml), --metadata (components by name, such as ApexClass:MyApexClass) or --source-dir (a folder). --pre-destructive-changes and --post-destructive-changes add the deletion manifests.

In scratch orgs and sandboxes, the commands track changes (source tracking) by default. Production orgs never allow it.

Two flags need care. --ignore-conflicts overwrites changes made in the org. --ignore-errors deploys what does not fail and does not roll back the rest; the reference forbids it in production.

Test levels

--test-level sets which Apex tests run during the deployment:

  • NoTestRun. None. Valid only in development environments, such as sandboxes or Developer Edition, where it is the default.
  • RunSpecifiedTests. Only those named in --tests. Each deployed class and trigger (types ApexClass and ApexTrigger) needs 75% coverage.
  • RunLocalTests. All, except those from installed managed and unlocked packages. It is the production default when the deployment includes classes or triggers.
  • RunAllTestsInOrg. All, including those of managed packages.
  • RunRelevantTests. In beta: Salesforce picks the tests related to what is deployed.

If a deployment to production includes no Apex, no tests run by default. In production, any failure rolls back the whole deployment.

Validate now, deploy later

sf project deploy validate runs the tests without saving anything and returns a job ID. It requires tests: its default level is RunLocalTests and it does not accept NoTestRun.

If the validation succeeds, sf project deploy quick --job-id deploys without rerunning the tests. The ID is valid for 10 days. --use-most-recent only finds validations from the last 3 days.

Both commands are for production; in a sandbox, use sf project deploy start --dry-run --test-level RunLocalTests. What is deployed overwrites the org’s version, without merging.

Change sets

A change set sends customizations from one org to another from Setup. It holds Setup changes, never data such as records. It is available in Enterprise, Performance, Professional, Unlimited and Database.com editions.

It only travels between orgs affiliated with the same production org, such as production and its sandboxes. It needs a deployment connection, and each org must be authorized to send or receive.

The source org creates an outbound change set and uploads it; after that it cannot be edited or recalled, only cloned. The target org receives it as inbound, can validate it, and deploys it as a whole, not component by component.

Its limits:

  • Up to 10,000 files and 400 MB; Salesforce advises staying under about 5,000 components.
  • It does not delete or rename components.
  • Components it does not support are repeated by hand in the target org.
  • While it is validated or deployed, the org accepts no setup changes; data stays accessible.
  • In production it runs local tests by default if it includes classes or triggers; in a sandbox, none.

Lifecycle Center, formerly DevOps Center

From October 2026, DevOps Center is renamed Lifecycle Center. It is Salesforce’s tool for managing changes and releases with a point-and-click interface. It captures each change in a source control system, which becomes the source of truth. Salesforce presents it as an alternative to change sets.

Each change is tracked in a work item and moves through a pipeline, the sequence of stages up to production. Lifecycle Center creates the branches, copies of the project where you change things without affecting others, and the pull requests (review requests) for the team.

Facts for the decision:

  • It is on by default and opens from the App Launcher.
  • The org that hosts it, the Hub org, cannot be a sandbox.
  • It needs GitHub.com cloud plans or Bitbucket Cloud.
  • Editions: Professional (with API access), Enterprise, Performance, Unlimited and Developer. It is not in Government Cloud Plus or EU Operating Zone.

Since April 2026, the previous version, DevOps Center (Managed Package), accepts no new installations. Those who have it can keep using it, but not at the same time as Lifecycle Center.

Packages

A package is a container of related metadata that is installed in an org:

  • Unlocked package. For internal apps, unless they are distributed on AppExchange. Its source of truth is version control. Uninstalling it deletes all its components from the org.
  • Second-generation managed package (managed 2GP). For ISV (independent software vendor) partners that distribute their app.
  • Unmanaged package. Salesforce advises against using it to move components from a sandbox to production.

Ant Migration Tool, retired

Ant Migration Tool is a Java- and Ant-based command-line utility. It retrieves and deploys metadata through Metadata API. It is configured with build.xml, which defines the tasks, and build.properties, which holds the credentials.

Salesforce retired it with Spring ’24. It keeps working with future API versions, but without new functionality or support. The guide still links the Winter ’24 download and recommends switching to Salesforce CLI.

Which tool for which situation

Which deployment tool to useFour steps in order. At each step, if the answer is yes, the arrow leads to the tool; if no, go down to the next step. Step 1: if the app is distributed to other companies, a second-generation managed package. Step 2: if the metadata is organized in versioned modules, an unlocked package. Step 3: if you deploy from a local project or with scripts, Salesforce CLI. Step 4: if the team wants a point-and-click pipeline with source control, Lifecycle Center. If the answer is no at all four steps, change sets between orgs of the same production org. Ant Migration Tool does not appear because it is retired.Step 4Step 3Step 2Step 1NoNoNoNoDistributedto othercompanies?Managedpackage2GPVersionedmodules?UnlockedpackageLocal projector scripts?SalesforceCLIClick-basedpipeline withsource control?LifecycleCenterChange setsin the sameproduction org

Steps 1 and 2 decide whether the change travels in a package; steps 3 and 4, which tool carries loose metadata.

Example: retiring a field at a private bank

A private bank replaces a field on the client record, Account.Segmento__c, with a new one. An Apex class stops using the old field.

  1. Tool. It is not distributed or packaged, and the team works with a local project: Salesforce CLI.
  2. Manifests. sf project generate manifest --source-dir force-app creates the package.xml. sf project generate manifest --metadata CustomField:Account.Segmento__c --type post creates destructiveChangesPost.xml: the field is deleted after the class is deployed.
  3. Validation. On Thursday the team runs sf project deploy validate --manifest package.xml --post-destructive-changes destructiveChangesPost.xml --target-org prod. It runs RunLocalTests without changing anything.
  4. Deployment. On Saturday, sf project deploy quick --job-id <ID> --target-org prod applies the change without rerunning the tests.
  5. Afterwards. The deleted field stays in the production Recycle Bin, because purgeOnDelete does not work there.

When to use each tool

The criterion that separates them is what moves and who moves it.

Tool Use it when Do not use it when
Salesforce CLI There is a local project, scripts or continuous integration. Nobody on the team uses the command line.
Change sets A Setup change moves between orgs of the same production org. Components must be deleted or renamed.
Lifecycle Center Admins and developers share a pipeline with source control. There is no cloud GitHub or Bitbucket.
Unlocked package Internal metadata is organized in versioned modules. The app is distributed to other companies.
Ant Migration Tool Only to keep legacy scripts running while they are migrated. Any new work.

Before production

  1. Review the manifest: only what is listed travels.
  2. Check the deletion order with destructiveChangesPre.xml or destructiveChangesPost.xml.
  3. Remember that in production deleted components go to the Recycle Bin and roll-up summary fields are purged.
  4. Set the test level and confirm 75% coverage per class and trigger.
  5. Never use --ignore-errors against production.
  6. Validate the deployment and run the quick deploy before 10 days pass.
  7. Replace Ant Migration Tool scripts with Salesforce CLI.

Official sources

Back to the knowledge base