Skip to content
Tutorials Center
My learning

Topics

Lesson 32 of 36 ยท Apps and Deployment

Change Sets and Deployment in Salesforce

Move Salesforce changes safely: outbound and inbound change sets, dependencies, validation and quick deploy, what cannot be deployed, and options like DevOps Center, with JavaScript stand-ins.

Once a change works in a sandbox, you have to move it to production. That step, deployment, is where many outages happen: a missing field, a forgotten permission, a flow that references something that does not exist yet. The default declarative tool is the change set, which packages metadata in one org and sends it to another connected org. This lesson explains change sets in detail, their limits, a safe deployment routine, and the alternatives for teams that outgrow them.

The Salesforce screens are described in words. The demonstrations are labelled JavaScript stand-ins that model dependency checks; they are not Salesforce.

How change sets work

A change set is a bundle of metadata components, sent from a source org to a target org. Both orgs must be connected by a deployment connection, which exists between a production org and its sandboxes (and between sandboxes of the same production org). You cannot send a change set between unrelated orgs.

The workflow:

  1. Authorize: in the target org, Setup, then Deployment Settings, tick Allow Inbound Changes for the source org. (The first time only.)
  2. Create an outbound change set in the source org: Setup, then Outbound Change Sets, then New. Give it a clear name (for example INC-1042 Case escalation flow) and a description.
  3. Add components: Add chooses by type (Flow, Custom Object, Custom Field, Page Layout, Permission Set, Report, Validation Rule, Apex Class, and so on). Use View/Add Dependencies to include what the components need.
  4. Upload to the target org (the Upload button). It can take minutes.
  5. In the target org, open Inbound Change Sets, and click the change set.
  6. Validate (a deployment dry run): this runs the same checks and, for production, the required Apex tests, but changes nothing. Fix errors in the source org, upload a new change set, and validate again.
  7. Deploy (or Quick Deploy, see below). Review the deployment status in Deployment Status.

Change sets can be cloned and versions are not tracked: once uploaded, a change set is locked, and an edit means a new one.

Dependencies

A component often depends on others: a flow uses a custom field, which belongs to a custom object; a page layout uses fields and related lists; a permission set grants access to fields and objects. If a dependency is missing in the target, the deployment fails with a message such as Field Case.Escalation_Reason__c does not exist. Use View/Add Dependencies in the change set, and still read the list because the tool misses some links (for example, record types, picklist values that a record type uses, and references inside formulas to fields on other objects).

Rules of thumb:

  • Deploy objects and fields before the flows, layouts and permission sets that use them (or in the same change set).
  • Deploy permission changes (permission sets, profiles) deliberately: a profile in a change set only carries the settings of the components in that change set, but it can overwrite settings if you add the wrong parts. Prefer permission sets for access changes.
  • Picklist values deploy with the field, but changes to values do not always remove old ones in the target.

Validation and Quick Deploy

For deployments to production, if your change set includes Apex classes or triggers, Salesforce requires that tests run (at least 75 percent code coverage overall, with every trigger covered). Pure declarative changes (flows, fields, layouts) do not need Apex tests, but Salesforce can run all local tests at deployment depending on the setup, which makes deployments slow in big orgs.

Validate first during business hours (it takes the same time as a deployment, without changing anything), then use Quick Deploy within 10 days to deploy the validated change set without running the tests again. Quick Deploy turns a 40-minute window into a couple of minutes at the maintenance time you choose.

What change sets cannot do

  • They cannot delete components. Removing a field or flow in the target is a manual step (or needs another tool with destructive changes).
  • They do not include some settings and org configuration (for example parts of Setup that are not metadata, like some email deliverability settings or Experience Cloud site content in older cases).
  • They cannot move data (records). Use the Data Loader (see Importing data and the Data Loader) for reference data such as custom metadata records, or use custom metadata types and custom settings that deploy with the metadata.
  • They have no version history and no merge: two people building in different sandboxes can overwrite each other.
  • They are manual: a long list of components is error-prone.

Other deployment tools

When change sets become painful, teams move to:

  • DevOps Center: Salesforce's free tool that connects work items, version control (GitHub or another Git service) and pipeline stages, with a mostly declarative interface.
  • Salesforce CLI (sf) with source tracking and Git: developers pull metadata from a sandbox, commit, review and deploy with sf project deploy start.
  • Metadata API and Ant: older scripted deployments.
  • Unlocked packages and managed packages: versioned, installable bundles for modular architecture or products sold on AppExchange.
  • Third-party DevOps tools (Copado, Gearset, AutoRABIT, Flosum, and others): comparison of orgs, selective deployment, rollback and automation.

The principle stays the same: source of truth is version control, not any org, and changes move through a pipeline with checks.

A safe deployment routine

  1. Describe the change and its risk; get approval.
  2. Build and test in a Developer sandbox; test the experience of a non-admin user.
  3. Prepare a deployment checklist: components, manual steps (for example activate the flow, add the page to the app, assign the permission set), and a rollback plan.
  4. Deploy to an integration or UAT sandbox first, and run UAT.
  5. Validate in production at a quiet time; Quick Deploy in the agreed window.
  6. Do the manual post-steps, run a smoke test (open a record, run the flow, check a report).
  7. Tell users what changed (release notes), and update documentation.
  8. Refresh or sync sandboxes so they match production.
flowchart LR
  B["Build in Dev sandbox"] --> T["Test and review"]
  T --> CS["Create outbound change set"]
  CS --> U["Upload to target"]
  U --> V["Validate (dry run)"]
  V -->|"Errors"| B
  V -->|"Success"| QD["Quick Deploy in the window"]
  QD --> S["Post-deployment steps and smoke test"]

The change-set loop: errors send you back to the source org, never to editing the target by hand.

Stand-in: dependency check

This stand-in is not Salesforce. It checks whether a change set includes everything its components need, which is the logic behind the "missing dependency" failures.

JS Stand-in: find missing dependencies

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Stand-in: a release checklist

JS Stand-in: go or no-go

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Between which orgs can you send a change set?

    A deployment connection exists between a production org and its sandboxes.
  2. 2. What is Quick Deploy used for?

    Validate first, then Quick Deploy later without rerunning the tests.
  3. 3. Which task can a change set NOT do?

    Change sets cannot delete components.
  4. 4. A deployment fails with 'Field does not exist'. What is the most likely cause?

    Components must travel with, or already exist alongside, the things they use.

Summary

  • Change sets move metadata between connected orgs: authorize, create outbound, upload, validate, deploy.
  • Check dependencies carefully; deploy structure before the things that use it.
  • Validate first, then Quick Deploy within 10 days; know that change sets cannot delete components, move data or track versions.
  • For bigger teams, use DevOps Center, the Salesforce CLI with Git, packages or a DevOps tool, with version control as the source of truth.

Next: Lightning App Builder and pages