Shipped
Salesforce rebuild
- Salesforce
- Flows
- Bulk API 2.0
- Python
- HubSpot
- Before
- 106 of ~16k leads ever converted · sync ~45%
- Action
- Evidence-based re-staging, conversion onto matched accounts, sync repair
- After
- ~4,800 converted · sync 99.99%
- Verified by
- Re-query of prod · sandbox flow tests 48/48
The problem
When I joined a healthcare credentialing company in August 2026, its Salesforce org no longer matched reality.
- 106 of about 16,000 leads had ever converted. A Salesforce lead isn't linked to an account until it converts. So people at customers and open deals were missing from those accounts, which broke attribution and HubSpot's company lists.
- About 11,600 leads sat in "New", and 7,671 of them had logged activity. Reps worked leads without changing the status. Nothing ever moved a lead out of New; it was just the default.
- No audit trail. Lead history tracked only the owner field, with zero status changes recorded.
- HubSpot had a lead status for 5,844 of 13,012 lead-linked contacts, about 45%.
Constraints
- This was the live org. Everything went to a sandbox first. Every bulk write ran from a file, with a backup or revert file kept next to it.
- A wrong match does more harm than a missed one. Large health-plan families share email domains, so I held back every unclear match.
- No fake pipeline. No opportunities were created during conversion.
- Only two-way evidence counts. A form fill is the lead's source, not engagement. Opens and clicks don't count either. I filtered out 46 auto-replies and 71 vendor or support threads.
- The HubSpot connector only acts on change. It syncs one way, reacts only when a value changes, and never backfills a new mapping.
How it works
- Re-stage from evidence. For each of the 11,579 open "New" leads, I pulled its tasks, emails, meetings, Gong flows and HubSpot replies. Each lead got a proposed stage, a reason and the evidence behind it. Engaged means the prospect's own last touch was within 180 days: a reply, a meeting, or an answered call of 60 seconds or more. Working means a rep reached out within 180 days. Older leads go to the matching Lost stage. I tested 90, 180 and 365 days as the cutoff: the engaged-then-silent group came out at 413, 383 and 366, so the choice barely mattered. One bulk job moved 2,957 leads with 0 failures.
- Keep stages moving. Five flows set the stage now. Replies, meetings and Gong calls move a lead to Engaged. Rep outreach moves it to Working. A bounce moves it to Disqualified, and a "stop" reply counts as an opt-out. A daily sweep moves leads to Lost after six months of silence. Lost and Disqualified leads need a reason from a dropdown, and I backfilled about 4,300 reasons. A test script creates throwaway sandbox leads and checks every transition: 48/48 on the latest rules.
- Convert only where certain. A lead converted only if three things held: its account is a customer or has had an opportunity, the lead belongs to exactly one account, and it's a real person. About 4,800 converted. Where a contact already existed for that person, the lead was merged into it. Matching leads to accounts is a separate system, "Lead and account hygiene".
- Route and audit. A territory flow now assigns leads to the regional BD. I retired a rule that sent leads to a queue whose members had left and re-routed 2,034 queue leads. Status history is on.
- Repair the sync. I added the new stage values to HubSpot first, spelled exactly as in Salesforce, then ran a list resync. Blanks went from 7,165 to 1 in under 5 minutes.
Prospect activity moves a lead to Engaged, rep outreach to Working, a bounce to Disqualified, and six months of silence or an opt-out to a Lost stage with a reason; every stage syncs to HubSpot.
Receipts
- Stages after the backfill: New 6,307 · Working 222 · Engaged 89 · Working Lost 2,263 · Engaged Lost 327 · Disqualified 1,787.
- Where the conversions landed: about 3,050 on customer accounts, 790 on accounts with an open opportunity, 1,010 on closed-lost accounts (useful for win-back) and 30 other.
- Sync: 13,011 of 13,012 lead-linked contacts match Salesforce, with zero mismatches.
What broke, and what I changed
- My first sync fix did nothing. On a 200-lead pilot I re-saved each status with its own value. None of them reached HubSpot in 30 minutes, because a same-value write isn't a change. No data changed. I switched to HubSpot's list resync.
- Early conversions failed. One run left 305 errors: queues can't own converted records, and the duplicate rule blocked others. So converted records now go to an active user, scripted jobs bypass the duplicate rule, and batches stay at 40 or fewer. The next batch fixed 294 of the 305; the other 11 were test leads.
- The stage-reason resync stalled at 102, then 0, then 20 records. I added a temporary marker to the reason detail on 4,320 leads, so the connector saw a real change. HubSpot pulled 2,146, 1,697 and 363 reasons within three minutes. Then I restored the original values and confirmed they matched.
What I'd do next
From the end-of-September summary:
- Reassign about 3,200 open leads and 1,000 contacts still owned by people who have left. HubSpot writes to them fail.
- Give converted people a live status. Contacts have no status field, so a converted person's HubSpot status freezes. That needs a field on Contact, filled at conversion and mapped to HubSpot.
- Review the 115 leads held back for manual account matching.