Metadata deployment moves configuration and code between Salesforce environments: from a developer sandbox to a test sandbox, from a source repository to an org, and finally into production. A deployment creates, updates, or deletes metadata such as objects, fields, flows, Apex classes, layouts, and permissions. Most deployment pain comes from three sources: missing dependencies, stale information about the destination org, and production requirements such as passing tests.
Common Deployment Problems
- Missing dependencies. A deployed asset references something that does not exist in the destination, such as a field used by a layout or a class used by a flow.
- Stale comparisons. Someone changed the destination after the last comparison, so the deployment overwrites or conflicts with work that was not reviewed.
- Profile side effects. Profiles and permission sets deploy permissions only for the assets included, and can carry references to assets missing in the destination.
- Test failures. Production deployments run Apex tests and require code coverage, so a failing test anywhere blocks the release.
- No undo. Salesforce has no built-in rollback for a completed deployment.
How to Approach a Deployment
- Refresh both sides. Capture current metadata from the source and the destination, and check recent setup changes and deployment history.
- Build explicit lists. Decide exactly which assets to create or update, and which destination assets to delete.
- Include related assets. Add dependent assets the destination is missing, and remove bad references that would fail.
- Validate first. Run a validation that checks for errors and runs tests without changing the org.
- Deploy in a window. Deploy production changes in a planned window, using a validated deployment where possible, and keep a snapshot of the destination from before the release.
How Snapshot Helps
- Deploy Metadata: in Settings, check Deployment History and Setup Audit Trail and use Take Destination Snapshot to refresh stale destination metadata. In Create Assets, Add Selected, Add Missing, Add Different, or Add Related build the Create Job List, and Delete Assets builds the Delete Job List. Choose Check For Errors Without Making Changes, Roll Back All Changes If There Is An Error, or Change Everything Possible And Ignore Errors (not available for production). Results show Created, Changed, Unchanged, Deleted, or Error for each asset, plus test errors.
- Quick Deployment: releases a previously validated deployment to production without rerunning tests, using the Quick Deploy ID. The ID expires after 10 days or after any other deployment to the same org.
- Deploy Zip File: validates or deploys a metadata ZIP file built by Snapshot or another tool, with selected Apex tests.
- Deployment Results Report: reviews past deployments between two orgs, with Salesforce results and the original job lists for reuse.
Successful validation and selected tests do not establish full business-process or regression coverage.
Metadata Types Involved
-
Profile: a frequent source of deployment errors and unexpected permission changes. -
FlowandFlowDefinition: flow versions and which version is active after deployment. -
CustomObjectTranslation: translations that travel separately from the objects they translate.
Common Questions
What is the difference between validating and deploying?
Validation runs the full deployment checks and tests without changing the org. Deployment applies the changes.
Can I undo a Salesforce deployment?
Not with a built-in button. Rolling back means deploying the earlier versions of the changed assets and deleting assets the release created, which requires a copy of the metadata from before the release.
Why did my deployment fail on a component I did not change?
Deployed assets can reference other assets that are missing or different in the destination, and production deployments run tests across the org. Check dependencies and test results, not only the changed assets.