06RevenueType: Reference architecture
One item, one committed deal
A Zoho CRM design for one-of-a-kind stock: every deal names one item, the item record alone decides availability, and a deposit commits the item to one deal.
Shows
- Business Automation
- Data Architecture
- Software Architecture
Where this comes from: Drawn from systems I've designed on Zoho. The business, names and data here are generalized. The patterns and failure modes come from real work, and the design includes what that work taught me.
On This Page
In 30 Seconds
Some businesses sell items that exist only once: a machine, a property, a vehicle. In this architecture, every deal in Zoho CRM is tied to exactly one item, and availability is a state stored on the item record, never pieced together from deals. Several salespeople can work the same item until a buyer pays a deposit. At that moment the item is reserved for that deal, and every competing deal and its quotes stop.
What It Guarantees
- Every deal names exactly one item, so every check knows what it is checking.
- A deal can't start on, or switch to, an item that isn't Available.
- Availability has one answer, read from the item record alone.
- A deposit reserves the item for one deal and stops every other deal on it; two deposits in the same instant need the queue described below.
- No deal skips a stage: Blueprint, Zoho's stage-by-stage process tool, holds the order and the checks between stages.
The Problem
Picture a business that sells high-value items one at a time: a machine, a property, a vehicle. Leads, follow-ups and stock live in spreadsheets and in conversations between colleagues.
Nobody can see, in one place, who is handling a customer. Simple questions take a search or a call. Has anyone contacted this customer? Is a colleague already negotiating on this item? Is it still available? The answers depend on memory.
A wrong answer means two salespeople promising the same item to two buyers, or a deposit taken on something already gone.
A standard CRM pipeline tracks deals, not things. If availability is inferred from deal stages, it is only as right as every deal's stage, and two deals in flight on one item contradict each other.
The Approach, in One Sentence
Every deal points to one item, only the item record holds availability, and the buyer's deposit commits the item to one deal and stops every competing deal.
Architecture
Connections in this diagram
- Lead → Deal names one item (converts)
- Deal names one item → Item available? (created or changed)
- Item available? → Deal blocked (no)
- Item available? → Quote and offer (yes)
- Quote and offer → Deposit recorded (offer accepted)
- Deposit recorded → Item reserved (commits item)
- Item reserved → Competing deals stop (locks others)
- Item reserved → Sales order (deal proceeds)
- Sales order → Contract (signed)
Key Decisions
One deal, one item
Alternatives: a deal that carries several items, or an item named in free text. I chose a required link to exactly one item. Every later step then knows which item it is about, and each check is a single lookup. A buyer who wants two items gets two deals: a small price for rules that never guess.
The item record decides availability
Alternatives: infer it from deal stages or open quotes, or keep a separate stock list. I chose an explicit state on the item, with four values: Available, Reserved, Sold and Withdrawn. Inferred availability breaks the moment two deals disagree. A stored state gives people, reports and automation the same answer, and a reservation is linked to the deal that holds it.
Commit at the deposit
Alternatives: reserve when a deal is created, or only when the sale closes. Reserving at the first inquiry locks stock for buyers who may never commit, and salespeople learn to work around the lock. Reserving at the sale is too late: two buyers can both pay. The deposit is the first real commitment, so the lock belongs there.
Protection in layers, not one gate
Alternatives: rely on Blueprint alone, or on training. Blueprint enforces the rules between stages, but a stage move is only one way a deal changes. So a separate check runs whenever a deal is created or its item changes, quotes on competing deals lock, and the screens add their own protection. Each layer covers a path the others don't watch.
When Things Go Wrong
A deal is opened on an item that is reserved, sold or withdrawn
→ The check reads the item record and blocks the deal before anyone works on a wrong assumption.
A salesperson swaps the item on an open deal
→ The same check runs. A deal can't move onto an item that isn't Available.
Two salespeople work the same item, and one buyer pays a deposit
→ The item becomes Reserved, linked to that deal. The other deals are restricted and their quotes locked, so nobody keeps negotiating on an item that is gone.
An item is sold or withdrawn
→ Setting it to Sold or Withdrawn restricts the other open deals on it the same way.
The holding deal falls through
→ A person sets the item back to Available and clears the hold. Deals stopped earlier stay stopped; a salesperson reopens one deliberately.
Someone tries to jump a deal to a later stage
→ Blueprint allows only the defined transitions, and its validations must pass.
What the Business Gets
- One place answers "who has this customer?" and "is this item still available?", without a search or a call.
- Salespeople can work the same item freely until a buyer commits money. After that, every other deal on it stops.
- Managers see activity and progress in the same records the team works in.
For Engineers
Records (generic names)
Item: identity and description;availability(Available, Reserved, Sold, Withdrawn);heldBy, a lookup to the deal that holds a reservation.Deal: a required lookup to exactly oneItem; its stage runs under Blueprint.Quote, sales order and contract: each belongs to a deal and is about that deal's item.
One source of truth. No deal or quote stores a copy of availability. Every check reads the item when it runs, because a copy goes stale the moment another deal moves.
Checks run when a deal is created, when its item changes, when a deposit is recorded, and whenever an item stops being Available.
Blocked and restricted. Both set a state on the deal that Blueprint and a lock rule respect: no further stage moves, quotes read-only, and the reason on the record.
onDealSaved(deal): # created, or item changed
if read(deal.item).availability != AVAILABLE: block(deal)
onDepositRecorded(deal):
item = read(deal.item) # fresh read, never a copy
if item.availability != AVAILABLE: block(deal); return
item.availability = RESERVED; item.heldBy = deal
onAvailabilityChanged(item)
onAvailabilityChanged(item): # reserved, sold or withdrawn
if item.availability == AVAILABLE: return # a release reopens nothing by itself
for d in openDeals(item) where d != item.heldBy:
restrict(d); lockQuotes(d) # a state: repeating it is harmless
A limit to know. The check and the reservation are two steps, so two deposits recorded on one item at the same moment could both pass. Where that can happen, put reservations through one queue that handles one item at a time, so the second deposit finds the item already Reserved. A unique field alone isn't enough: in my tests, the platform's unique check stopped back-to-back repeats but let parallel writes through. That may have changed.
How I Build Systems Like This
For stock that exists once, I start from the item's states, the events that move it between them, and the record that owns each fact. Then I write the rule at each stage and the options I rejected. From that design, AI agents (Claude Code) now do much of the hands-on building and checking; in production they read by default, and any write waits for a backup and my approval.