Skip to Content
All Systems

01IntegrationsType: Reference architecture

CRM and ERP in step, with no silent overwrites

A reference design for two-way sync on serverless middleware: one owner per field, and a person for anything ambiguous.

Shows

  • Enterprise Integrations
  • Software Architecture
  • API Design

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

Middleware on Zoho Catalyst keeps Zoho CRM and an ERP in step in both directions, through one durable queue: a table with one row per record. Every field has one owning system and syncs only from it. Outages make work wait, bad data waits for a fix, and anything ambiguous stops for a person.

What It Guarantees

  • A record edited on both sides is never silently overwritten.
  • An outage never turns good data into failed records.
  • A create with an unknown outcome is never retried blindly.
  • Staging a change twice is a no-op, and only writes known to be safe retry on their own.
  • The sync's own writes never bounce back as new changes.

The Problem

Picture a distributor whose sales team works in Zoho CRM while finance, stock and deliveries run in an ERP. Staff type every customer twice, and sales can't see balances, orders or deliveries.

A link sounds simple until you list what it must survive. The two systems fail and throttle independently. The ERP keeps its own numbering and stays the reference for money. An order can't exist in the ERP before its customer does. Change events arrive late, twice or out of order. The ERP's API has no idempotency key, so when a create times out, nobody knows whether it landed. And the customer record lives in both systems, edited by two teams.

Workflow rules and scheduled scripts handle the happy path and fail quietly on the rest.

The Approach, in One Sentence

Every change becomes one row in a durable queue and reaches the other system only when the write is known to be safe; otherwise the row waits or stops for a person.

Architecture

How a change moves between CRM and ERP
ERP changesRecords changed since the last good pull
CRM changesChange event: record id and time
Nightly safety netRe-stages recent records; unchanged ones cost nothing
Durable queueOne row per record, with state and fingerprint
Read fresh, validateMissing data waits, with the reason on the record
Target changed since?Compared with the last value the sync wrote
Park and waitOutage or throttling; retry budget untouched
Write on shared keyUpsert on the ERP id, automations off
Stop for a personConflict or unclear create, flagged on the record

Connections in this diagram

  • ERP changes → Durable queue (stage)
  • CRM changes → Durable queue (stage id)
  • Nightly safety net → Durable queue (re-stage)
  • Durable queue → Read fresh, validate (claim)
  • Read fresh, validate → Target changed since? (valid)
  • Target changed since? → Write on shared key (no)
  • Target changed since? → Stop for a person (yes)
  • Write on shared key → Park and wait (system down)
  • Write on shared key → Stop for a person (create unclear)

Key Decisions

  1. A middleware with a durable queue, not CRM workflows calling the ERP

    The alternative was Deluge on workflow triggers, plus an hourly scheduler. Deluge has no durable queue, no locking and no backoff, so any state between runs is hand-built in CRM records. Yet each record in flight needs saved state before any external write, and retries and alerts need one home.

  2. One owner per field, not "last write wins"

    The alternatives were last write wins, or the newest timestamp. Clocks in two systems disagree. I've seen a wrong time-zone assumption shift every pull window by hours. The customer record lives in both systems, so I split it by field: sales owns contact details, finance owns terms, balances and numbering.

  3. Classify every failure before retrying

    The alternative was one retry policy for everything, which lets an outage burn every record's retries. So system failures (timeouts, server errors, throttling) park without counting an attempt. Missing data waits for a fix before any write. A rejected write spends the record's few retries, then waits for a person. A transport error on a create goes straight to a person, because a retry could create the record twice.

  4. Match on the ERP's internal id, not a natural key

    The alternatives were tax id, email or name. Branches share a tax id, and customers share emails. The id lives in a unique CRM field, and every upsert names it as the match field. Zoho's API documentation says that, unless told which field to match on, its upsert (insert or update, matched by key) checks system duplicate-check fields such as an account's name first, then unique fields. An account could then match another with the same name.

When Things Go Wrong

  • The ERP goes down or throttles

    A short run of system failures opens a circuit breaker (a switch that stops all calls to the ERP) for a couple of minutes. A rate-limit answer keeps it open for as long as the ERP asks. Rows park, pulls keep their watermark (the time of the last good pull), and work resumes on its own.

  • A create times out

    The row goes to the dead-letter queue, where a person sees a hint: search the ERP for the CRM id before replaying. A timed-out update is parked and retried, since it is idempotent: sending it twice gives the same result.

  • Someone edits an owned field on the wrong side

    Before writing, the sync compares the target with what it last wrote. If they differ, the row stops as a conflict, and a person picks the value.

  • Records arrive out of order

    Each run handles customers, then deals, then quotes, so a new customer unblocks its quote in the same run. A row still waiting for its parent after about two hours goes into the next daily digest.

  • The source sends an empty value

    Blank means "nothing sent", not "erase". Only a field's owner can clear it.

What the Business Gets

  • Staff type a customer once, and sales sees balances, orders and deliveries in the CRM.
  • Finance keeps the ERP as the reference for numbering and money.
  • Problems show on the record that has them, with a reason anyone can act on.
  • An outage costs time, not data, and one switch pauses all ERP writes without loss.

For Engineers

How I Build Systems Like This

I start from a written spec, a data dictionary of every synced field, and a decision on which system owns each one. AI agents (Claude Code) help with analysis, review and audits under written rules: read-only by default, a backup before any write, no deploy until live code matches the repo. In my audits, every claim records how it was verified.

How I Build With AI

On LinkedIn: more notes on Zoho architecture and AI.