Global HubSpot lead routing the sales team can manage
A global life sciences company with sales teams across North America and Europe.
Over 100 territory rules inside one block of code
Every new contact needed to reach the right sales rep, and the rules for deciding who that was changed from one market to the next. In the United States, territories were set by zip code, with several reps sharing a single metro area. Elsewhere in North America the split was by state. In Europe, some reps covered a whole country, some covered several, and in at least one country the territory was divided by region.
All of that logic lived in a single custom code action inside a HubSpot workflow. It had been written some years earlier and ran to tens of thousands of characters. Rep IDs, long strings of zip codes and the order in which rules were checked were all written into the code itself, and some of them appeared in more than one place. The code had grown as the sales team changed around it.
One small mistake could stop leads reaching anyone
Changing a single territory meant finding every place it appeared and editing the code by hand. A missing comma, a stray quote mark or a zip code pasted into the wrong list could break the whole action, or quietly send leads to the wrong rep. Nothing would flag the error at the time of the edit. The first sign would be a rep asking why their leads had dried up, or a new lead sitting with nobody.
Nobody could see who owned what
There was no simple view of a rep's territory. To answer a basic question such as "which zip codes does this rep cover?" someone had to read through the code and piece it together. Overlaps between reps were hidden in the order of the code, so a territory could end up claimed twice without anyone noticing. Sales leadership had no way to review the territories without asking someone technical to explain them.
I'm over the moon, Carl, I really am.
A rules table in HubDB and a small code action that never needs editing
Territory changes in minutes, without a developer
Every territory across North America and Europe held in one table, in check order.
Territory changes are made in the table. The code action stays as it is.
Built with HubDB and workflows the company already had in HubSpot.
Tested by the team, then live
The new routing was built and tested in the company's sandbox portal and handed to the sales operations team to review with sales leadership. Once they are happy with the rules, it moves to the live portal.
"I think that will probably solve the issue and make it so much easier to manage."
HubSpot team, global life sciences company"I can run it through with the team, watch them hopefully light up as much as I just have."
HubSpot team, global life sciences company
If the business ever wants a dedicated marketplace app later, the rules are already clean, documented and ready to move
A structured diagnostic that maps exactly where your HubSpot architecture is breaking down and produces a prioritised blueprint for what needs to change.
Learn about the Revenue Reset →Every engagement starts with a Revenue Reset.
"A Revenue System Health Score and a Revenue Architecture Blueprint specific enough to present to your board or your investors as a plan of action."