Sub topic 1
From change sets to a managed release process
This chapter explains why Salesforce teams move from change sets to a managed release process, and what that process needs to include. It sets up the rest of the tutorial, which covers how DevOps Center provides it.
Prerequisites
This chapter assumes you have:
- Basic Salesforce administration or development experience, including sandboxes, metadata, and change sets.
- Familiarity with Git concepts such as branches, commits, pull requests, and merges.
- A rough idea of what a production org and a sandbox are, and how they relate.
You do not need to have used DevOps Center yet. Later chapters cover setup.
How change sets work, and where they stop working
A change set is a bundle of metadata components that you build in one org and upload to another org that is connected to it. The receiving org sees an inbound change set, and an administrator validates and deploys it.
Change sets are simple. They need no tooling beyond the Setup menu, and many teams ship real work this way. Their weaknesses appear as the team and the org grow.
| Area | Change set behavior | Consequence for a team |
|---|---|---|
| History | No record of what changed inside a component, only that it was uploaded | You cannot see who changed a field's definition or why |
| Versioning | Each deployment overwrites the target org's version | You cannot return to an earlier version of a component |
| Connections | Only orgs with a deployment connection can exchange change sets | Moving a change across a non-linear path takes extra steps |
| Collaboration | One person builds each change set by hand | Two people editing the same component can overwrite each other |
| Review | No built-in review step | Peer review happens outside the tool, or not at all |
| Selection | Components are picked manually | A missing dependency shows up as a failed deployment |
| Repeatability | Rebuilding a change set means picking components again | Different orgs can drift apart |
None of these is a defect in change sets. They follow from the fact that a change set carries a snapshot of components and nothing else. It has no memory of earlier releases and no shared record that the whole team works from.
The release problems a process must solve
A managed release process answers a set of questions that change sets leave open.
- What is in this release? You need a list of changes, each tied to a reason, such as a user story or a bug report.
- Who changed it, and when? You need an audit trail that survives after the person who made the change has moved on.
- Did it work before it reached production? You need the same change to pass through testing stages in order.
- Can two people work at once? You need a way to combine parallel work and detect when it overlaps.
- Can we undo it? You need an earlier known-good version to return to.
Teams that answer these questions with spreadsheets and shared documents tend to find that the documents fall out of date. The answers need to live in the same system that moves the metadata.
Source-driven development
The answer the Salesforce platform has settled on is source-driven development. In this model, a version control repository (usually Git) holds the metadata for the project, and that repository is the source of truth. Orgs are places where you build and test, and production is where the released result runs. None of them is the reference copy.
This changes the daily workflow in four ways.
- Every change is a commit with an author, a timestamp, and a message.
- Work happens on branches, so parallel changes stay separate until someone merges them.
- Merging goes through a pull request, which gives reviewers a place to comment.
- Any earlier state of the project can be recovered from the history.
The project layout that Salesforce tooling expects is a directory of source-format metadata described by an sfdx-project.json file. A minimal one looks like this:
{
"packageDirectories": [
{ "path": "force-app", "default": true }
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "62.0"
}The packageDirectories entry tells tooling which folder holds the tracked source. Here it is force-app. The sourceApiVersion value sets the metadata API version used when source is converted or deployed. This is the layout a DevOps Center repository uses, so you will meet it again when you create a project.
A .forceignore file lists paths that tooling should skip, so editor settings and caches do not travel with real metadata:
# .forceignore
**/jsconfig.json
**/.eslintrc.json
**/__tests__/**
.sfdx
.sfWhat a managed release process looks like
Source control alone does not make a release process. You also need a defined route for a change to follow. A managed process has these parts:
- Work items. Each change is recorded as a unit of work with a description and a status.
- Isolated development. Each developer or admin builds in a development environment, so unfinished work does not affect others.
- A branch per unit of work. The change is captured in source as a set of commits on its own branch.
- Review. A pull request lets another person approve the change before it merges.
- Ordered stages. The change moves through environments, such as integration, user acceptance testing (UAT), and staging, before production.
- Validation at each step. Tests run before a change is allowed forward.
The following diagram shows the route.
Each box is a handoff that change sets leave to convention. A managed process makes each one a recorded step.
Where DevOps Center fits
DevOps Center is a Salesforce tool, available inside your org, that provides this route without requiring you to write scripts. It presents the work in terms an administrator already knows, such as projects, work items, and environments. Behind the scenes, it creates branches, commits, and pull requests in your Git repository, and it deploys the merged source to the next environment.
The practical effect is that an administrator who builds in a sandbox with point-and-click tools gets the benefit of version control without learning Git commands. A developer who prefers the command line can still work in the repository directly. Later chapters cover the pieces in detail: the project, the pipeline, work items, and promotion.
You can also check a change outside DevOps Center. The Salesforce CLI can run a validation-only deployment against a stage's org, which tests the change without saving it:
sf org login web --alias uat
sf project deploy start --source-dir force-app --target-org uat --dry-run --test-level RunLocalTestsThe --dry-run flag runs the deployment as a check only. The --test-level RunLocalTests flag runs all tests in your org except those from installed managed packages.
Git also lets you compare what two stages contain. This lists the commits that have reached the UAT branch but not yet the main branch, which shows what the next promotion would carry:
git fetch origin
git log --oneline origin/main..origin/UATCommon mistakes when moving off change sets
- Treating a sandbox as the source of truth. If people keep editing production or a shared sandbox directly, the repository falls out of step with the orgs. Decide that changes enter only through the pipeline.
- Putting everything in one large work item. A big change is hard to review and hard to roll back. Keep each work item small and about one purpose.
- Skipping the first sync. The repository needs to match production before the first change moves. Otherwise early releases carry unrelated differences.
- Committing local tooling files. Without a
.forceignore, caches and editor settings end up in the repository and may break deployments. - Expecting full metadata coverage. Some metadata types cannot be tracked or deployed through source. Check the limits chapter before you plan a migration.
Summary of the shift
| From | To |
|---|---|
| Org as the reference copy | Repository as the reference copy |
| Manual component selection | Changes captured from tracked work |
| Informal review | Pull request review |
| One-step upload | Ordered stages with validation |
| No history | Full commit history |
Exercise
A team deploys with change sets. Last week two administrators edited the same flow in different sandboxes, and the later upload silently replaced the earlier work. Which two parts of a source-driven process would have prevented or exposed this, and why?
Show answer
Branches and pull requests. Each administrator's change would live on its own branch, so the two edits stay separate until merged. When the second change is merged, Git detects that both touched the same file and reports a conflict, so someone must resolve it deliberately. The pull request also gives a reviewer the chance to notice the overlap before it reaches production.
Exercise
What does the --dry-run flag do in sf project deploy start --source-dir force-app --target-org uat --dry-run --test-level RunLocalTests, and why is it useful before a promotion?
Show answer
It runs the deployment as a validation only, so the org's tests run and the result is reported, but no changes are saved to the target org. It lets you find failing tests or missing dependencies before the real promotion.