Back to Insights

Deploying to Salesforce without breaking everything: Change Sets, SFDX and good practices

Pierre FrinJune 20267 min read
Dev Sandbox Full Sandbox Staging / UAT Production SALESFORCE · DEPLOYMENT · SFDX

Deployment is the most dreaded phase of a Salesforce project. Not because it is technically complex, but because it concentrates every risk built up during development, and a mistake here hits real production.

I have seen deployments stall for hours because a validation rule was left out of the Change Set. I have seen data migrations fail silently because the target field did not exist in production yet. Here is what I have learned to do every single time.

Change Sets vs SFDX: understanding what you are choosing

Change Sets

  • Point and click interface in Setup
  • No technical prerequisites
  • Ideal for small, targeted changes
  • Dependencies handled manually
  • No native version control
  • Slow on large volumes of metadata

SFDX / CLI

  • Command line plus Git
  • Native version control
  • Ideal for teams and complex projects
  • Dependency handling can be automated
  • Steeper learning curve
  • Reproducible and auditable

The rule I apply: Change Sets for quick fixes and for projects with no dedicated development team. SFDX as soon as there are several developers, a need for reproducibility, or regular deployments.

The classic mistakes, and how to avoid them

Deploying straight from Dev to Production

This is mistake number one. A development sandbox never looks exactly like production: the data is different, profile configurations can drift, and customisations made directly in production (yes, that happens) are not in the sandbox.

The correct chain: Dev → Full Sandbox (or Partial) → UAT/Staging → Production. Each stage filters out problems that would not have surfaced in the previous one.

Forgetting dependencies in the Change Set

A custom field on a standard object depends on another field, on a record type, on a validation rule. Leave one component out of the Change Set and a deployment error is guaranteed.

Salesforce checks some dependencies automatically, but not all of them. The habit to build: always deploy to the Full Sandbox before production, and confirm everything works before going any further.

Never deploy on a Friday afternoon. If something goes wrong, you get either an emergency weekend or a Monday morning crisis. Risky deployments go out early in the week, with the teams available.

Ignoring code coverage

Salesforce requires 75% Apex code coverage for a production deployment. That threshold is often scraped through with tests that do not really test the behaviour of the code, only its coverage.

Tests that cover real scenarios (bulk, errors, edge cases) prevent regressions after deployment. Tests written just to hit the coverage number give a false sense of safety.

Having no rollback plan

Salesforce gives you no way to "undeploy" a Change Set. If a deployment causes trouble, rolling back means either a new corrective deployment or deleting the added components by hand.

Before every significant deployment: document the pre-deployment state, list the components being changed, and define the rollback procedure in case something goes wrong.

The checklist before every production deployment

01
Deploy and validate in the Full Sandbox
The Full Sandbox is the closest replica of production. If it passes here, the risk in production drops significantly.
02
Check code coverage, for real
75% minimum, but aim for 85%+ with tests that cover bulk scenarios and error cases.
03
Document the deployed components
A list of the objects, fields, classes, workflows and flows included in the deployment. Essential for the rollback.
04
Plan a maintenance window
Tell the users, block access if needed, and keep the technical teams available.
05
Validate in production immediately after the deployment
Do not walk away before checking the critical features on the live system.

For teams that deploy regularly: invest in SFDX and a CI/CD pipeline (GitHub Actions, Azure DevOps) as soon as you pass 2 deployments a month. The time saved and the reduced risk more than justify it.

Pierre Frin
CRM consultant · Adobe Campaign · Salesforce · Imagino · Grokium

A Salesforce deployment to make safe?

The scoping call is free and comes with no commitment. 30 minutes to define the scope and confirm feasibility.

Contact →
Go further
My CRM services All technical articles Get in touch