Skip to content
Manan Asim

CRM architecture & data integrity

885 orphaned deals, and the timing problem behind them

A medical spa’s HubSpot pipeline had quietly desynchronised from its point-of-sale system. Deals were reaching Appointment Scheduled with no appointment attached. The cause was not the automation logic. It was the order the events arrived in.

By Updated

Key figures

Scope and diagnostic figures from the engagement

  • 885orphaned deals identified
  • 6+overlapping workflows competing to move the same deals
  • 4×daily batch sync from the point of sale, the source of the gap
  • 2defects caught in validation, before launch

Engagement

Client
Multi-location medical spa
Sector
Medical aesthetics
Engagement
Diagnostic + build
My role
Design and engineering
Delivered
At Growlyze Technologies
Download case study (PDF)

Tech stack

  • HubSpot Operations Hub
  • Custom-coded actions (Node.js 20)
  • CRM v3 API
  • CRM v4 Associations API
  • Custom objects
  • Private apps

Architecture

How the pieces connect

  1. 01 Booking
    • Point of saleowns the calendar
  2. 02 Sync
    • Batch sync, 4× dailyappointment arrives late
  3. 03 Triggers
    • Appointment createdprimary path
    • Deal event, delayedbackup path
    • Nightly sweepsafety net
  4. 04 Engine
    • Association engineseven-step selection rule
  5. 05 Result
    • Deal linked to appointment
    • Ambiguous: flagged for reviewnever guesses
  • Source
  • Step
  • Logic
  • Output

01 · Challenge

Deals were reaching Appointment Scheduled with no appointment attached. Six or more overlapping workflows tried to move them forward, and attribution broke wherever the link was missing.

02 · Strategy

Trace the failure to its cause, a race between a deal-side trigger and a point-of-sale sync that runs four times a day, then invert the trigger: one association engine reached by three independent paths.

03 · Impact

885 orphaned deals identified and explained. The engine is built and validated against live records, two defects were caught before launch, and the historical repair is staged behind five controls for client sign-off.

01Context

The client runs daily aesthetic appointments across several centres. HubSpot is the marketing and sales system of record. A separate point-of-sale platform owns the booking calendar, and a third-party integration pushes appointment records into HubSpot as a custom object.

A large and growing population of deals had reached Appointment Scheduled with no appointment object attached and no appointment date populated. Six or more overlapping workflows had accumulated over time, each trying to move deals forward on a slightly different signal. None of them reliably created the association itself.

Attribution flows through the deal-to-appointment link, so every orphaned record was booked revenue that could not be traced back to the campaign that produced it.

02Root cause: a race condition, not a logic error

Every workflow that tried to advance a deal was triggered by a deal-side event. When a booking is entered at the point of sale, the rep updates the contact’s lead status, which immediately fires automation and advances the deal. The appointment record only arrives in HubSpot later, on a batch cycle that runs four times a day.

So the record each workflow needed did not exist yet at the moment it ran, sometimes for hours. No amount of refinement to a deal-triggered workflow changes when it runs.

03Approach

  1. Diagnose before building

    Root-cause analysis plus an audit of the objects and properties involved: the Appointment custom object, start time, point-of-sale status and final sale price.

  2. Invert the trigger

    One association engine, reached by three independent paths. The primary path fires the moment an appointment record is created or updated. A deal-triggered backup deliberately waits before evaluating. A nightly safety net passes over deals still missing an association.

  3. A seven-step selection rule

    Restrict to the right pipeline and the two qualifying stages. Exit if the deal already carries an appointment, so existing links are never overwritten. Filter to the single open status out of nineteen. Discard appointments already serving another deal. Keep those dated today or later, nearest first. Prefer the nearest with a sale value above zero, and fall back to the nearest regardless.

  4. When in doubt, halt

    Where a contact holds more than one qualifying deal, the engine does not choose. It stops and flags the record for human review.

  5. Validate one record at a time

    The workflow stayed deactivated during testing. Records were enrolled manually, one by one, across five case types, and each run emitted a structured decision trace explaining what it did and why.

  6. Fix what validation surfaced

    Two defects were caught before launch. Appointments associated to several contacts had been resolved by trusting whichever the API returned first. And date-only values were being compared as timestamps, so timezone arithmetic pushed them back across the day boundary. Comparison moved to whole calendar days.

04Remediation controls

Repairing 885 historical records is not a code problem. It is a blast-radius problem. The historical run is wrapped in five controls.

  • Dry run before any write
  • Client review of the proposed changes
  • A suppression flag to exclude records
  • Staged rollout rather than one bulk pass
  • An audit trail logging both record identifiers on every write, so the run is fully reversible

05Where it stands

StageStatus
BuiltEngine deployed and validated
TestedVerified against live records
StagedHistorical remediation held for client sign-off
The automation was never wrong. It was simply asking a question the system could not yet answer, and then never asking again.
From the project write-up