Salesforce Deployment Best Practices: Sandboxes to Rollback

A release goes out on Friday afternoon. By Monday, a validation rule blocks new opportunities and a flow sends duplicate emails. The Gearset State of Salesforce DevOps 2026 surveyed 522 respondents. In it, 18% of teams said they primarily find issues in production.
Salesforce deployment best practices exist to stop that Monday. They govern where changes are built, how source control tracks them, how they are tested and when they ship. This guide turns Salesforce deployment best practices into rules an admin or release manager can apply this quarter.
Key Takeaways
- Build in sandboxes, keep every change in Git, and treat production as a target, never a workspace.
- Validate each package against a Full sandbox, then use quick deploy inside an agreed release window.
- Write a rollback plan, a backup step and a post-deployment test list before any release starts.
What Are Salesforce Deployment Best Practices?
Salesforce deployment best practices are the rules a team follows to move metadata into production safely. Metadata means objects, fields, Apex classes, Salesforce Flow automation, page layouts, profiles and permission sets. Data records are a separate job with separate tools.
Salesforce deployment best practices sort into six groups. A release manager should be able to answer each question below before a salesforce deployment starts.
- Environments: where is each change built, tested and approved?
- Source control: where is the single record of what changed and why?
- Testing: which tests prove the change works and breaks nothing else?
- Validation: has the exact package passed a check-only run against a production-like org?
- Release: when does it ship, who approves it, and who is on call?
- Recovery: how does the team roll back a Salesforce deployment that fails?
Salesforce publishes its own guidance in the Salesforce Developers blog on Metadata API deployments (2025). It covers validate-only runs, quick deploy, test levels and dependencies. It also lists checks for before and after a release. The sections below adapt those Salesforce deployment best practices for a mid-sized B2B team.
Unboxx applies these rules on client orgs through its Salesforce CRM services. The same rules work for an in-house team with one admin and two developers.
Why Do Salesforce Changes Break in Production?
Most production breaks trace back to four causes. They are missing dependencies, untested automation, drift between environments and edits made straight in production. All four are process failures, so Salesforce deployment best practices start with process and leave tools for later.
Missing metadata dependencies
A field added to a page layout needs the field itself in the package. A flow that updates a custom object needs that object and its picklist values. Salesforce's own 2025 guidance names missing dependencies as a common cause of deployment errors.
Metadata dependencies are easy to miss in a change set, because the tool does not list them for you. A dependency report or an org comparison tool closes that gap.
Automation nobody tested together
Two admins build two record-triggered flows on Opportunity in separate sandboxes. Each works alone. Together they fire in an order nobody planned, and the second flow overwrites the first. Regression testing in a shared org catches the clash before users do.
That shared test run is why Salesforce deployment best practices insist on an integration sandbox. The article on Salesforce Flow best practices explains how to keep one entry point per object.
Metadata drift between orgs
Metadata drift is the gap between what production holds and what a sandbox holds. It grows every time someone edits production directly or a sandbox goes months without a refresh. A package that passed in a stale sandbox can then fail in production.
The culprit is usually a field, a validation rule or a permission set that differs between the two orgs. Of all Salesforce deployment best practices, a regular refresh schedule costs the least to adopt.
Changes made straight in production
Quick fixes in production feel faster, but they skip review and leave no record in source control. The next salesforce deployment from a sandbox can then overwrite them. Old shortcuts like these are a main source of the debt described in Salesforce technical debt.
Which Salesforce Sandbox Strategy Supports Safe Releases?
A safe Salesforce sandbox strategy gives each stage of work its own org. The stages are build, integration, user acceptance testing and staging. Production comes last. Salesforce deployment best practices build everything else around that order.
Salesforce lists four sandbox types in its Salesforce sandbox guide (updated 2026). The limits below decide how each one fits into the path.
| Sandbox type | Data storage | Refresh interval | Best stage |
|---|---|---|---|
| Developer | 200 MB | Once per day | Building one feature |
| Developer Pro | 1 GB | Once per day | Integration and QA |
| Partial Copy | 5 GB | Every 5 days | User acceptance testing |
| Full | Same as production | Every 29 days | Staging and performance tests |
A typical path for a team of four to ten people has five stops. Each developer or admin builds in a Developer sandbox or a scratch org. Finished work merges into a shared Developer Pro sandbox for integration.
Business users then test in a Partial Copy sandbox with sample records. The final package is validated in a Full sandbox before production.

Teams that cannot afford a Full sandbox license can stage in a Partial Copy sandbox. The trade-off is weaker performance testing and less realistic data volumes. The Apex Developer Guide on code coverage recommends a Full sandbox as the staging environment for production deployments.
For sandboxes, Salesforce deployment best practices reduce to one rule. Every org in the path has a single job, and nobody builds in the org that tests.
How Do You Keep Salesforce Sandboxes in Sync?
Teams keep Salesforce sandboxes in sync by treating Git as the source of truth. Every org receives its metadata from Git, not from another sandbox. A sandbox refresh only copies production, so the refresh plan and the branch plan must match.
A large development team should follow four rules to keep Salesforce sandboxes in sync:
- Deploy the main branch to the integration sandbox after every merge, so it always matches source control.
- Refresh Developer sandboxes after each release, since the refresh interval is once per day.
- Refresh the Partial Copy sandbox at the start of each test cycle, at least 5 days apart.
- Plan the Full sandbox refresh around the 29-day limit, ideally right after a production release.
After a refresh, redeploy open feature branches from Git into the new sandbox. That step removes metadata drift without asking anyone to rebuild by hand. Scratch orgs go further: each one is created from source, used for one feature and then deleted.
Post-refresh tasks belong on a written list. Typical items are updating named credentials, masking personal data, resetting integration users and switching off outbound emails. Skipping them is how a sandbox ends up emailing real customers.
Under Salesforce deployment best practices, someone runs that list on the day of every refresh.
How Should Version Control Work for Salesforce Teams?
Salesforce version control best practices put every metadata change in Git before it reaches a shared org. Each change goes through a pull request first. Source control records who changed what and when, and it makes rollback possible.
Pick a simple Git branching strategy
A clear Git branching strategy for most Salesforce teams has three branch types. Main matches production. A feature branch holds one user story or bug fix. A short-lived release branch collects approved features for one release window.
Hotfix branches start from main and merge back to it at once. Salesforce deployment best practices still send a hotfix through review. A team that needs one every week has a testing gap.
Review every change in a pull request
Each pull request should show the metadata diff, link the user story and name a reviewer. Code review on Apex is standard. Reviews on flows, profiles and permission sets matter as much. A one-line permission change can expose data to the wrong users.
Tools that connect Git to orgs
GitHub, GitLab and Bitbucket all host Salesforce source. The Salesforce CLI retrieves and deploys metadata from the command line and runs inside CI/CD pipelines. DevOps Center adds a point-and-click layer for admins. Its developer guide explains that source tracking records each change, who made it and when.
Small merges reduce merge conflicts. A feature branch that lives for two days merges cleanly. One that lives for six weeks collides with everyone else's work on the same profile or layout.
Keeping branches short is one of the Salesforce deployment best practices a team can start tomorrow at no cost.
What Testing Catches Issues Before Go-Live?
Four layers of testing catch issues before they go live. They are Apex unit tests, automated regression testing, user acceptance testing and a final validation in staging. Each layer finds a different kind of fault, so dropping one leaves a gap.
Apex test coverage is a floor, not a goal
Salesforce requires at least 75% Apex test coverage to deploy to production. The Apex Developer Guide adds a second rule. A deployment fails if the average coverage of new and existing code falls below 75%.
Code coverage shows which lines ran, not whether the logic is right. Good test classes assert expected results and create their own data.
Automated regression testing
Regression testing reruns key business paths after every change. Examples are creating a lead, converting it, closing an opportunity and generating a quote. Automated tools run these paths in the integration sandbox on each merge. Manual scripts work for smaller teams if someone owns them.
A regression suite counts as part of the release under Salesforce deployment best practices. A release that skips it is not ready.
User acceptance testing
User acceptance testing puts the change in front of the people who will use it. A sales manager checks the new stage rules. A service lead checks case routing. Sign-off should be written, dated and attached to the user story, so the release manager knows what was approved.
Post-deployment testing
Salesforce advises rerunning Apex or manual tests after deployment, even when tests already ran during it. Post-deployment testing should follow a short, written smoke-test list that a named person runs. The release stays open until that list is signed, a rule Salesforce deployment best practices treat as fixed.
How Do Validation and Quick Deploy Reduce Risk?
A validation deployment runs the full deployment and all required tests without saving anything. Quick deploy then pushes that same validated package without running the tests again. Together they move the slow, risky part of a release out of the release window.
The Metadata API supports this through a check-only option. Salesforce describes the validate-only run as a test run that runs all tests and verifies components. The default test level for production is RunLocalTests. It runs every test in the org except those from managed packages.

A practical sequence that follows Salesforce deployment best practices looks like this:
- Freeze the release branch the day before the release.
- Validate the package against the Full sandbox, then against production.
- Fix any failure, then validate again from the start.
- Inside the deployment window, run quick deploy on the validated package.
- Run the post-deployment smoke tests and confirm with the business owner.
Set rollbackOnError to true on production deployments. The Metadata API then rolls back the whole deployment if any component fails. Production never holds half a release.
Each metadata api deployment is also capped at 10,000 files and a 39 MB compressed file. Large releases may need to be split into smaller packages. Early validation and small packages are two Salesforce deployment best practices that reinforce each other. A small package validates faster and fails more clearly.
Which Salesforce Deployment Tool Fits Your Team?
The right tool depends on team size, release frequency and whether anyone writes code. Salesforce offers three native routes, and third-party DevOps platforms add automation on top. Salesforce deployment best practices hold whichever route a team picks.
| Tool | Best for | Source control | Main limit |
|---|---|---|---|
| Salesforce change sets | One admin, rare releases | None | No rollback, manual dependency picking |
| DevOps Center | Admin-led teams moving to Git | Built-in Git link | Fewer pipeline options than code tools |
| Salesforce CLI and Metadata API | Teams with developers | Any Git host | Needs scripting skills |
| Third-party platforms | Frequent releases, large teams | Any Git host | License cost |
Salesforce change sets suit a single admin who ships declarative changes once a month. They move metadata between connected orgs but keep no history. Every release then depends on memory.
DevOps Center replaces change sets for admin-led teams. It adds work items, pipeline stages and a Git repository behind each project.
Teams with developers usually run ci/cd for salesforce through the Salesforce CLI. A pipeline validates every pull request against a sandbox, runs Apex tests and deploys the main branch on approval.
Third-party platforms such as Gearset and Copado add org comparison, backups and rollback features. Unlocked packages suit teams that want modular releases of related metadata.
Choose the simplest tool that gives source control and validation. Following Salesforce deployment best practices with plain Git and the CLI beats an expensive pipeline run without rules.
What Belongs on a Salesforce Deployment Checklist?
A salesforce deployment checklist lists every task before, during and after a release, with an owner for each. It puts Salesforce deployment best practices on one page the team ticks through on release night.
Before the release
The pre-deployment checklist is where Salesforce deployment best practices slip first when a release runs late. Keep it short enough to finish.
- Back up metadata and data, as Salesforce's 2025 guidance advises.
- Review the Setup Audit Trail for recent edits made in production.
- Confirm the package validated against production within the last day.
- List destructive changes that delete fields, classes or flows.
- Name the person on call and the business owner who signs off.
During the release
- Post a start message to users and pause scheduled data loads.
- Switch off any automation the runbook says to pause.
- Run quick deploy and watch the deployment status page.
After the release
- Run the smoke-test list and switch paused automation back on.
- Tag the released version in Git and close the release branch.
- Send release notes to users and log any issues found.
Keep the checklist in the same repository as the metadata. Each release then leaves a dated record of who did what.
How Do You Plan Releases and Rollbacks?
Salesforce release management best practices fix a regular release window, a written runbook and a tested way back. A predictable salesforce release process tells users when changes land. It also tells the team who decides if something goes wrong.
Set the release window and cadence
Salesforce recommends off-peak deployment windows such as evenings or weekends. Avoid quarter-end, payroll runs and large data loads. Gearset's 2026 survey found release frequency centred on weekly or more often. Deployment frequency should match how fast the team can test, not how fast it can build.
Follow a salesforce deployment order
Copado's 2022 guide suggests a salesforce deployment order. Objects go first, then Apex classes, components, profiles and sharing rules. Splitting a large release in that order keeps each step small enough to check.
Ordering packages this way also heads off dependency errors, which is why Salesforce deployment best practices include it.

Plan the deployment rollback
Salesforce does not keep earlier versions of metadata. A deployment rollback therefore means redeploying the last good version from Git. Keep that version tagged and validated. Destructive changes need extra care, because a deleted field also deletes its data. Export that data before the release.
A worked example shows the cost of skipping these steps. Assume a team of six ships 40 changes a month and 10% fail in production. Assume each failure takes four hours to find and fix.
That is 16 hours a month of rework, plus user disruption. These figures are illustrative, not survey data.
Track change failure rate and recovery time each month. Gearset's 2026 survey found nearly two thirds of teams restore normal service within six hours of a production incident. The better target, and the point of Salesforce deployment best practices, is needing fewer recoveries at all.
Frequently Asked Questions
How do you deploy from sandbox to production?
Teams deploy from sandbox to production with change sets, DevOps Center or the Salesforce CLI. Build and test in sandboxes, then commit to Git. Validate the package against production, and run quick deploy in an agreed window. Finish with post-deployment smoke tests and a sign-off from the business owner.
How often can you refresh a Full sandbox?
Salesforce lets you refresh a Full sandbox every 29 days. A Partial Copy sandbox can be refreshed every 5 days, and Developer and Developer Pro sandboxes once per day. Plan the Full refresh straight after a production release so staging matches production for the next validation.
What Salesforce DevOps setup suits a small team?
A small team gets the most from DevOps Center with Git, Developer sandboxes and one Partial Copy sandbox. That setup adds source control and review without scripting. Salesforce devops tools with full pipelines become worth their cost once releases happen weekly. Start small and add automation later.
Why does a Salesforce deployment fail validation?
A salesforce deployment failed validation usually for one of three reasons. The causes are a missing dependency, an Apex test failure or code coverage below 75%. Read the component errors first and add the missing metadata. Fix or rewrite the failing tests, then validate again from the start.
Who should own Salesforce release management?
Salesforce release management belongs to one named release manager, often a senior admin or the CRM lead. That person runs the calendar, approves packages and decides on rollback. Teams without one can use Salesforce managed services to cover release work and on-call support.
How Can Teams Apply Salesforce Deployment Best Practices Now?
Teams can apply Salesforce deployment best practices with three steps. Stop editing production, put metadata in Git and validate every package in a Full or Partial Copy sandbox. Add a release window and rollback plan next. The Salesforce implementation checklist shows how to assign owners to each step.
Unboxx sets up sandbox paths, Git pipelines and release runbooks for B2B teams on Salesforce. This Salesforce performance success story shows the result. To put Salesforce deployment best practices in place for your org, schedule a consultation with the Unboxx team.
Let's create something out of this world together.
Have a project in mind? Contact us for expert design and development solutions. Let's discuss how we can help grow your business.
Ready to Unboxx Your Potential?
Build smarter systems. Automate faster. Scale confidently.
