Sub topic 8
Developing in a sandbox with change tracking
This chapter assumes you have a project, a pipeline and a connected development environment. It also assumes you have created a work item. Here you learn how changes you make in a sandbox end up in the work item.
How change tracking works
A development environment in DevOps Center is a sandbox with source tracking turned on. Source tracking is a Salesforce feature that records which metadata components you create, edit or delete in an org. DevOps Center reads that record and lists the changes. It does not watch your clicks. It asks the org what changed.
Developer and Developer Pro sandboxes have source tracking on by default. For Partial and Full Copy sandboxes, check that tracking is enabled when you create them. Production and sandboxes without tracking cannot serve as development environments.
A typical working session
- Open the project in DevOps Center and select your work item.
- Choose the development environment and open it from the work item.
- Build in Setup or in your editor. For example, add a custom field and update a page layout.
- Return to the work item and check the list of detected changes.
The next chapter covers pulling and committing. For now, treat the detected list as a preview of what the work item will contain.
One work item, one purpose
Source tracking is per org, not per work item. Every change in the sandbox appears in the list. If you work on two items in one sandbox, their changes are mixed. You then have to pick components by hand, and mistakes are easy.
Prefer one sandbox per developer. Finish and commit one work item before you start the next. Alternatively, give each work item its own sandbox.
Common errors
| Symptom | Likely cause | What to do |
|---|---|---|
| A change you made is missing from the list | The metadata type is not supported by source tracking | Check the supported metadata list. Handle that component with the CLI or a manual step. |
| Unrelated changes appear | Another work item or developer changed the same sandbox | Select only the components that belong to this work item. |
| The list is empty | You edited a different sandbox | Open the sandbox linked to the work item. |
| Old changes keep showing | Earlier changes were never committed or discarded | Commit them to the right work item, or refresh the sandbox. |
Keeping the sandbox in sync
A sandbox drifts from the pipeline as other work items reach later stages. Refresh it, or bring in newer changes, before you start a new work item. Otherwise you may build on an outdated base and cause conflicts later.
Exercise
You worked on two work items in the same Developer sandbox. The change list for the first item shows components from both. Why does this happen, and how do you avoid it?
Show answer
Source tracking records changes for the whole org, not for a single work item. To avoid the mix, use one sandbox per work item, or commit and finish one item before starting another. If the list is already mixed, select only the components that belong to the first work item.