Systems / Revenue system
CRM, routing and territory system
Routing carries out a coverage policy leaders agree on. It should never invent strategy in code.
The 30-second version
- Problem
- A medical-device and consumables business runs on HubSpot and Salesforce. Lifecycle stages, owners, territories and attribution all have to agree, or reports stop being trusted and leads land with the wrong rep.
- Decision
- Treat routing tables as data, lock manual handoffs so automation never overwrites a person, and keep lifecycle stages forward-only so funnel reports stay honest.
- Result
- I rebuilt lead routing for roughly 8,600 new contacts a year and restructured territory and assignment workflows for a new sales structure. The CFO thanked me in writing for the territory work, and it earned a Core Value Rockstar award.
- Why it's interesting
- Almost every routing bug I fixed turned out to be a policy question nobody had answered yet.
Product
Three groups depend on this system and want different things. Sellers want the right leads and no surprise reassignments. Leaders want coverage that matches the plan. Finance and the board want numbers that reconcile.
Routing is policy. The current rule set, simplified: a lead whose answer to the medical-director question is yes goes to outside sales by ZIP code. No or blank goes to inside sales. Areas without an outside rep go inside. A rep’s manual handoff is never overwritten. When a leader changes coverage, I change a table, not the logic.
One rule, two products. The public “Find a Provider” map listed practices that had stopped buying, and once even a rep’s home address. With Marketing, I wrote one eligibility rule and built a weekly custom-code job that writes the result, the inputs behind it, a last-run time and an error field to each company. The public map and seller segmentation now read the same fields.
Engineering
Design principles I hold to (all mirrored in the public repo):
- One workflow, one job, one owner prefix. Data and routing, deals and approvals, tickets and campaigns each have their own prefix.
- Routing tables are data. A territory change edits a ZIP or state map. It does not add branches.
- Rebuild, don’t patch. When routing logic gets messy, I clone it into a dated clean rebuild, test it, then retire the old one.
- Humans win. A manual owner handoff is locked.
- Forward-only lifecycle. Stages only move up. Churn changes the customer type, not the stage.
- Notify, don’t guess. When no rule matches, the owner gets a task instead of a silent default.
- Dry run first. Address repair and eligibility code run in a dry-run mode before any live write. A pilot of the address fixer on 50 deals filled 17 missing states and held 2 invalid ZIP codes for review before going wider.
Business
Routing errors are quiet. A lead with the wrong owner looks fine in a dashboard until a deal is lost. The value here is trust: leaders use the reports, and sellers stop working around the system.
What failed
The silent opt-out. During the Salesforce migration, a provider wrote in asking why our emails had stopped. I traced it to the integration writing an opt-out field at cutover, which had affected thousands of contacts. I built a review segment before any bulk change instead of re-subscribing everyone. A blind fix would have created a consent problem. Since then I check consent and lifecycle fields first after any sync change.
One match key, one point of failure. Updates were creating duplicate opportunities. The cause was a single ID used as the only match key, with no fallback. I recommended one system of record for opportunity data and limits on where deals can be created, and escalated the record-type fix to the team that owned it.
What I’d build differently
Monitoring before it’s needed. Integrations fail without telling anyone. An alert on sudden changes in consent fields, owners or lifecycle dates would have caught the opt-out problem in hours instead of a customer email.