Automation · Revenue operations
How to build a territory and quota sync
The new plan goes live on the first and half the pipeline changes owner overnight, including deals in negotiation. Here is the model behind a cleaner transition, the prompts that build it, and what it takes to run in production.
Built with Tray Headless
- System Plan
- Step Model coverage
- Step Effective date
- Step Protect in-flight
- System Salesforce
Deals past a stage stay with their owner through a territory change, because a relationship mid-negotiation is worth more than a tidy map.
The short answer
What is a territory and quota sync?
A territory and quota sync is four parts: coverage modelled before anybody signs off, application on the effective date instead of the day it was entered, in-flight deals protected so a relationship is not handed to a stranger mid-negotiation, and history retained because commission is calculated against the plan as it stood. The part that goes wrong most often is reassigning everything. Moving a deal in negotiation to a new owner because the map changed loses the deal, and no coverage model is worth that.
What matters here
- Protect deals past a stage. A relationship mid-negotiation is worth more than a tidy territory map.
- Apply on the effective date. A plan entered in December for January should not move anything in December.
- Model coverage before sign-off. An uncovered segment discovered in February is a quarter lost.
- Keep the history. Commission is calculated against the plan as it was, not as it is.
- Report accounts with no owner after every change. That list should be empty and rarely is.
Who this is for
You run revenue operations or sales operations. The plan changes annually, it is applied by hand or by a script somebody wrote once, and the first month afterwards is spent fixing ownership.
How it works in practice
The sequence, from a plan being agreed to the field working to it.
- 1
The plan is modelled before it is approved
Coverage, balance and quota against historical performance, so gaps are visible while they can still change.
- 2
Accounts are assigned by rule, not by list
Segment, geography and industry from data, so the plan survives an account changing shape.
- 3
Application waits for the effective date
Entered whenever, applied on the first, so nothing moves early.
- 4
In-flight deals keep their owner
Past a stage, the deal and the relationship stay put regardless of the new map.
- 5
Everybody is told what changed and why
Reps, managers and customer success, before the date rather than on it.
- 6
The old plan is retained
Because commission for the previous period is calculated against it.
What territory sync is made of
Four, and the third is the one that protects revenue.
Modelled coverage
Accounts, pipeline and quota per territory against historical attainment, run before sign-off rather than discovered afterwards.
Rule-based assignment
Territories defined as rules over account attributes, so an account changing segment is handled rather than requiring a manual move.
In-flight protection
Deals past a stage keep their owner. The map can wait; the negotiation cannot.
Retained history
Ownership as of a date, because commission and attainment are both calculated against the plan that was in force.
The Tray Headless prompts
Paste these into Claude Code or Codex with the Tray Headless plugin installed. Each stage runs on its own. The systems named in them are the worked example rather than a requirement, and every prompt says so.
Once per project, run
/tray-workflows:set-workspace
to pick the workspace these build in. Point it at a sandbox first.
- 1
Begin by modelling coverage before anything changes
A gap found in February is a quarter lost.
Headless skills
build-workflowtray-patternsUse build-workflow. The systems in play are Salesforce and Snowflake, or whatever we run in those seats. Before applying any plan, model it: for each proposed territory, the account count, total addressable spend, current pipeline, historical closed revenue, and the quota proposed against it. Then show me coverage multiple per territory, and flag any that is far above or below the others, plus any segment with no owner at all. An uncovered segment discovered in February has cost a quarter. The same gap seen in a model in November is a five minute conversation.
- 2
Define territories as rules, not lists
So an account changing shape does not require a manual move.
Headless skills
build-workflowUse build-workflow. Express each territory as a rule over account attributes: country, region, employee band, industry, and named account list where one genuinely applies. Rules evaluate in a fixed order and stop at first match, exactly as lead routing does, so an account can never belong to two territories. Named accounts are the exception, not the mechanism. A plan made entirely of named lists needs manual maintenance every time a company grows, and nobody does that maintenance. Show me every account that matches no rule. That list is the plan gap and it is never empty on the first run.
- 3
Apply on the effective date, and protect what is in flight
A relationship mid-negotiation is worth more than a tidy map.
Apply the plan on its effective date, not when it was entered. A plan agreed in December for January changes nothing in December. Then protect in-flight work. Any opportunity past a stage I set, or with activity in the last fortnight, keeps its current owner through the change, with an end date on that protection. Reassigning a deal in negotiation because the territory map changed is how a deal is lost. The new owner has no history, the customer has to start again, and the outgoing rep has no reason to help. Show me the protected list before applying, so somebody can decide on the exceptions instead of discovering them.
Protection needs an end date. Without one, an opportunity that stalls keeps its old owner indefinitely and the map is quietly wrong forever.
- 4
Tell everybody before the date
Because the first they hear should not be a missing account.
Headless skills
tray-gotchasUse tray-gotchas, then communicate before the effective date, not on it: Each rep: which accounts they gain, which they lose, and which they keep because a deal is in flight Each manager: their team's coverage and quota Customer success: which of their accounts changed owner, so the next customer conversation is not confused Handle these: an account in an active support escalation, which should flag rather than move silently; a customer whose champion has a personal relationship with the outgoing rep, which is a judgement rather than a rule; and a mid-year change, which needs prorating for quota and commission.
- 5
Keep the history, and check for orphans
Commission is calculated against the plan as it was.
Store ownership as history with valid-from and valid-to, not as a current field. Commission and attainment for a past period are calculated against the plan that was in force then, and a current owner field cannot answer that. After every change, report: Accounts with no owner, which should be zero Accounts owned by somebody who has left Opportunities whose owner no longer owns the account Territories with no rep assigned Coverage multiple per territory after the change Run those the day after application, not a month later. Every one of them is a gap somebody is not working.
- 6
Test it, then hand the rules to RevOps
Because territories change more than annually in practice.
Run the per-step schema checks and the whole-workflow audit before this touches production. Run the whole plan in preview first and have sales leadership read the movement list. Then open the same workflow in Tray Build so revenue operations can amend territory rules, protection thresholds and effective dates in the visual canvas.
What it connects to
The plan is a model, the CRM is where it lands, and everybody affected needs telling.
Salesforce
Read accounts, opportunities and current ownership, then apply the new assignment on the effective date.
Reads and writes
Snowflake
Model coverage and historical attainment, and hold ownership history for commission calculation.
Reads and writes
Workday
Read who is in seat, their start date and ramp, so a territory is not assigned to somebody who has not joined.
Reads
Slack
Tell each rep what they gain and lose before the date, and post the coverage model to leadership.
Writes
Same build, other stacks
The design does not change if you run something else in one of these seats. The same prompts build it against Microsoft Dynamics 365, Google BigQuery, Microsoft Teams, SAP SuccessFactors, Power BI or HubSpot.
Named systems are the ones most teams run, not the only ones that work. Each is an authentication in your Tray workspace, referenced by name, so the workflow never holds a credential. Where we have a connector page, the name links to it.
Running it in production
This moves revenue responsibility between people. Getting it wrong is felt for a quarter.
It runs on the platform, not on somebody's machine
Application fires on the effective date, months after the plan was entered, with the protection list evaluated at that moment, not when it was written.
Ownership is stored as history
Valid-from and valid-to per assignment. Commission for a past period is calculated against the plan in force then, and a current field cannot answer that.
Credentials are managed, never in code
Mass reassignment of account ownership is among the most disruptive writes available in a CRM. Scoped, in your workspace, and separately rotatable.
RevOps own the rules
Territory rules, protection thresholds and effective dates open in Tray Build, because territories change more often than annually in practice.
Preview before applying
The movement list read by sales leadership before anything changes. This is the one change where an error affects every rep at once.
Questions people ask
Why protect in-flight deals?
Because reassigning a deal in negotiation loses it. The new owner has no history, the customer has to start again, and the outgoing rep has no reason to help the handover.
Why rules rather than named lists?
Because a plan made of lists needs manual maintenance every time an account changes segment, and nobody does that maintenance. Rules handle it automatically and lists become the exception.
Why apply on the effective date?
Because a plan agreed in December for January should change nothing in December. Applying on entry moves accounts mid-quarter and distorts attainment for both reps.
Why keep ownership history?
Because commission and attainment for a past period are calculated against the plan that was in force then. A current owner field cannot answer who owned an account last March.
What should be checked after a change?
Accounts with no owner, accounts owned by a leaver, and opportunities whose owner no longer owns the account. Run it the day after, because every one is a gap nobody is working.
Vibe-coding app guides
Vibe-code an entire app with Helix
This moves the data between systems. It does not give anybody a screen to work in. Build that app in Claude Code, Codex or Cursor, then deploy and run it governed on Tray Helix. Same kind of guide, same kind of prompts.
How to build a quota and territory planner (opens helix.tray.ai in a new tab)
Related guides
Revenue operations
How to build a commission data to payroll sync
Qualify transactions against the plan, show the working line by line, hold disputes without holding the run, and reconcile before it pays. The prompts.
Revenue operations
How to build pipeline hygiene automation
Detect the staleness that matters, nudge the owner rather than the report, escalate on the deals that count, and measure whether it worked. The prompts that build it.
Last reviewed September 2026.