Workflows
A Workflow turns a DocType into a state machine — document moves between named states through allowed transitions, each requiring specific roles. Use when business rules say "this document must be approved by X before Y".
Anatomy
| Concept | Example |
|---|---|
| State | Draft, Pending Approval, Approved, Rejected |
| Action | "Approve", "Reject", "Send Back" |
| Transition | From state → action → to state, allowed for which roles |
Setting up
- DocType has a state field — by default, Frappe creates
workflow_state(Link to Workflow State). - Workflow State — define the states with a colour (Success/Warning/Danger).
- Workflow Action — the buttons users see ("Approve", "Reject").
- Workflow — the rules: from state X, action Y, allowed for role Z, moves to state W.
The workflow replaces the standard Save/Submit/Cancel buttons with the configured action buttons.
Example: Purchase Order approval
Draft → (Submit for Approval, role: Buyer) → Pending Manager
Pending Manager → (Approve, role: Purchase Manager) → Approved
Pending Manager → (Reject, role: Purchase Manager) → Rejected
Approved → (Cancel, role: Purchase Manager) → Cancelled
Notifications
Combine with the Notifications feature to email someone when a document enters a state ("PO awaiting your approval").
Limits
- Workflows are per-DocType; you can't share one across DocTypes.
- Only one active Workflow per DocType per Company.
- The transition role is checked at click-time; ensure roles match real responsibilities.
Last updated 3 days ago
Was this helpful?