Sub topic 7
Tracking changes with work items
This chapter covers the work item, the unit DevOps Center uses to track one change from request to release. It assumes you have a project with a pipeline and connected environments, and that you know Git branches, commits and pull requests. Exact status names and screens can vary by DevOps Center release, so check your org when a label differs.
What a work item is
A work item is a record in DevOps Center that represents one deliverable change, such as "Add a validation rule to Opportunity". It connects four things:
- A description of the change, such as a name, a summary and an assignee.
- A development environment, usually a sandbox, where the change is built.
- A Git branch that holds the committed metadata for that change.
- A position in the pipeline, which determines the stage the change has reached.
Change sets bundled components by hand and had no history. A work item replaces that bundle with a branch, so every change is a diff that can be reviewed, promoted and traced.
The working model
Each work item gets its own branch. When you create the work item, DevOps Center creates the branch from the branch of the first pipeline stage. Commits for that work item go only to this branch. Because the branch starts from the same baseline as the pipeline, a work item contains only what you committed and nothing from other people's work.
The work item also records its development environment. Every change you track in that environment is attributed to the work item. That is why the environment choice matters when you create the item.
Creating a work item
You create a work item from the project's Work Items tab. The form asks for these values:
| Field | Purpose | Common mistake |
|---|---|---|
| Name or subject | Short summary shown in lists and pull requests | Vague names such as "Fixes" |
| Description | Why the change exists and how to verify it | Leaving it empty, which hurts reviewers |
| Assignee | The person who builds the change | Assigning to someone without access to the environment |
| Development environment | The org where changes are made and tracked | Picking a shared sandbox that other people also use |
Write the name as an outcome a reviewer can check. "Require close date on Opportunity when stage is Closed Won" is better than "Opportunity update".
Work items and external trackers
If your team already plans work in GitHub Issues or Jira, you can link work items to those records. A work item is a release record. It does not replace your planning backlog. Keep one item per deployable change so that a failed change does not hold back unrelated ones.
Scope: how big should a work item be?
Size is the main design decision. The table below shows the trade-offs.
| Approach | Benefit | Risk |
|---|---|---|
| Small, single-purpose items | Easy to review, test and roll back | More items to track |
| Large feature items | Fewer records | Hard reviews, wider conflicts, all-or-nothing promotion |
| One item per user story | Maps to planning | Stories can mix unrelated components |
A good rule is that a work item should be something you would be comfortable reverting on its own.
Dependencies between work items
Work items are independent branches, but changes are not always independent. If item B uses a custom field that item A creates, B fails to deploy until A is promoted. Two approaches handle this:
- Promote A before B, in that order, through every stage.
- Make both changes in one work item if they cannot ship separately.
Record the dependency in the descriptions. DevOps Center does not infer it from metadata.
Following a work item in Git
Because each work item is a branch, you can inspect it with ordinary Git commands. This example assumes the work item branch is named WI-000042. Use the actual branch name shown on your work item.
git fetch origin
git log --oneline origin/main..origin/WI-000042
git diff --stat origin/main...origin/WI-000042The first command lists commits on the work item that are not yet on main. The second shows which files the work item changes. Use the three-dot form in git diff so the comparison starts at the common ancestor and ignores later changes on main.
Common errors
- Changes appear under the wrong work item. The development environment was tied to a different work item, or you made changes before selecting the right one. Check which work item the environment is currently tracking before you edit metadata.
- Pending changes list is empty. Some metadata types are not tracked by source tracking, and a change made in a different org is never seen. Confirm that the type is supported and that you are in the right sandbox.
- Unrelated components in a commit. Selecting everything in the changes list pulls in other people's edits in a shared sandbox. Select only the components that belong to this item.
- Work item blocked at promotion. An earlier item that it depends on has not been promoted. Check the stage where the dependency sits.
- Stale branch. A long-lived work item drifts from the stage branch, and conflicts grow. Keep items short, and bring in upstream changes before the pull request.
Ignoring files that should not travel
Work items track metadata, so local tooling files should stay out of the repository's deployable content. A .forceignore file handles this.
# .forceignore
**/jsconfig.json
**/.eslintrc.json
**/__tests__/**
.sfdx
.sfIf an editor or linter file ends up in a commit, the work item carries it into review and promotion.
What a finished work item tells you
When the item is complete, you can answer these questions from one record: who built it, which environment it came from, which commits and files it contains, who approved it, and which stages it passed. This audit trail is the main gain over change sets. It also makes rollback concrete, because the unit you revert is the unit you tracked.
Exercise
Two teammates share one sandbox and each has an active work item attributed to it. Why is this a problem, and what should they do instead?
Show answer
Source tracking attributes changes to the development environment, so both people's edits appear in the same changes list and can be committed to the wrong work item. Each active work item should have its own development environment, such as a separate sandbox or scratch-style environment per person. If that is not possible, finish and commit one work item before starting the other.
Exercise
Work item B uses a custom field created in work item A. B fails when promoted. What are two ways to fix it?
Show answer
Promote A through the pipeline stages before B, so the field exists in the target stage. Or, if the changes cannot ship separately, combine them into a single work item. In both cases, note the dependency in the descriptions.