Pipelines and stages
What Is It?
A pipeline is the set of stages a deal moves through (for example Qualification → Proposal → Negotiation → Closed). A stage is one step in that pipeline, and may be marked closed to represent a terminal outcome.
Why Would I Use It?
The pipeline is your sales process made visible. It lets a team agree on what "qualified" means, shows where deals stall, and makes forecasting possible.
Before You Begin
- A workspace with CRM enabled.
crm.pipeline.viewto read;create/update/deleteto manage (OWNER, ADMIN, MANAGER).- An understanding of whether you need one pipeline or several sales motions.
Where Can I Find It?
The pipeline and stage controls are reached from CRM → Opportunities
(/dashboard/crm/opportunities). The backend routes are
/api/v1/crm/pipelines/ and /api/v1/crm/pipelines/\{id\}/stages/.
How Does It Work?
The one-default rule
Every workspace always keeps exactly one default pipeline. This is enforced by the database and the service:
- Creating a workspace provisions the default pipeline and its standard stages.
- The last default pipeline cannot be un-defaulted.
- The last default pipeline cannot be archived.
- Making another pipeline the default transfers the flag atomically.
Opportunities created without an explicit pipeline land in the default pipeline's first stage. That is why opportunity creation works in a brand-new workspace.
Stages
- Stage names and order are unique among active stages within one pipeline.
is_closedmarks a terminal stage. Moving an opportunity backwards out of a closed stage requires explicit allowance; closed is not quietly reopened.- Reordering is a two-phase update inside one transaction, so order uniqueness holds at every intermediate step.
Permissions
| Action | Permission | Roles in V1 |
|---|---|---|
| View pipelines/stages | crm.pipeline.view | All roles |
| Create/update/archive pipeline | crm.pipeline.create/update/delete | OWNER, ADMIN, MANAGER |
| Create/update/reorder stage | crm.pipeline_stage.* | OWNER, ADMIN, MANAGER |
| Move an opportunity between stages | crm.opportunity.move_stage | OWNER, ADMIN |
How to Use It
Add a pipeline
- Open the opportunities area and choose to manage pipelines.
- Create a pipeline with a name and optional description.
- Add stages in the order the deal should move.
- Mark the final stage of each outcome as closed (won/lost style).
- Save.
Change the default pipeline
- Choose the pipeline that should be default.
- Set it as default. The previous default becomes a normal pipeline in the same transaction.
Reorder stages
- Open the pipeline's stage list.
- Move a stage up or down.
- Save. The backend parks stages at temporary unique positions, then writes the final order ascending.
Archive a stage or pipeline
- Choose archive.
- If the pipeline is the only default, archiving is refused. Set another default first.
- Archived stages leave the active list; opportunities keep their history.
What Happens Next?
- New opportunities use the default pipeline's first stage.
- Stage changes are recorded as
crm.opportunity.stage_changedactivities. - Reports such as pipeline and conversion read from the same stages.
Important Things to Know
- One default pipeline is a hard invariant, not a preference.
- Closed stages are terminal by default. Reopening requires deliberate action.
- A stage cannot move to another pipeline. An opportunity's stage must belong to its own pipeline.
- Deleting a pipeline in use is blocked; archive instead.
- Pipeline numbering does not exist — pipelines are named, not numbered.
Common Problems
| Symptom | Likely cause | What to do |
|---|---|---|
| "Cannot unset the last default" | Invariant | Set another pipeline as default first |
| "Stage name already exists" | Duplicate active stage name in that pipeline | Rename or archive the old stage |
| "Order already in use" | Concurrent reorder | Retry; the service serialises order writes |
| Opportunity creation fails | Workspace has no default pipeline | Run ensure_default_pipelines; check the invariant |
| Move stage returns 403 | Role lacks crm.opportunity.move_stage | OWNER/ADMIN action |