Sub topic 15
When to use other deployment tools
This chapter assumes you have built, uploaded, validated and deployed at least one change set. You should also know what a package.xml manifest is. Change sets work well for small, occasional moves between related orgs. Some situations call for a different tool.
Where change sets fall short
Each limitation below comes from how change sets work, and each one points to a different tool.
| Need | Why change sets struggle | Better fit |
|---|---|---|
| Delete a component in the target | A change set only adds or updates components | Salesforce CLI with a destructive changes file |
| Track who changed what and when | A change set has no version history and cannot be diffed | Source control (Git) with the CLI or DevOps Center |
| Repeat the same release often | You rebuild or clone the change set by hand | Scripted CLI deployments in a pipeline |
| Deploy to an unrelated org | Change sets need a deployment connection between related orgs | CLI, Metadata API, or a package |
| Deploy a component type that change sets do not list | Some metadata types are not supported | CLI or Metadata API |
| Distribute to many orgs or customers | You would repeat the deployment in each org | Unlocked or managed packages |
The main alternatives
- Salesforce CLI. It deploys and retrieves metadata from your computer or a build server. It uses the same manifest format you saw earlier. You can script it and store the results in Git.
- DevOps Center. It gives admins a visual pipeline built on Git, so changes are tracked without writing commands.
- Packages. An unlocked package groups metadata into a versioned unit. A managed package does the same for products you distribute to other customers.
- Third-party tools. Commercial release tools add comparison, rollback and approvals on top of the Metadata API.
A CLI version of the same move
The CLI can retrieve what a change set would contain and deploy it, with a test level you choose:
sf project retrieve start --manifest manifest/package.xml --target-org MySandbox
sf project deploy start --manifest manifest/package.xml --target-org MyProduction --test-level RunLocalTestsTo remove a component, add a destructive changes file. This is something a change set cannot do:
sf project deploy start --manifest manifest/package.xml --post-destructive-changes manifest/destructiveChanges.xml --target-org MyProduction --test-level RunLocalTestsChoosing a tool
Change sets remain a sensible choice when a few admins make occasional, small changes between a sandbox and production, and nobody needs a Git history. If you find yourself cloning change sets every week, or fixing mistakes because nobody recorded what changed, move to the CLI or DevOps Center.
Exercise
Your team must remove an obsolete custom field from production and wants a record of every release. Why are change sets a poor fit, and what would you use instead?
Show answer
A change set cannot delete components, and it keeps no version history. Use the Salesforce CLI with a destructive changes file, and keep the metadata in Git. DevOps Center is an alternative if the admins prefer a visual tool.