Salesforce Territory2 management methodology. Use when managing territory models, hierarchies, user assignments, account assignments, or territory planning.
From opspal-salesforcenpx claudepluginhub revpalsfdc/opspal-commercial --plugin opspal-salesforceThis skill is limited to using the following tools:
data-quality-protocol.mderror-taxonomy.mdhierarchy-design-patterns.mdimplementation-checklist.mdmethodology.mdDesigns and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
Invoke this skill when the user mentions:
Territory2Model (Container)
├── Territory2Type (Category/Priority)
├── Territory2 (Individual territories)
│ ├── UserTerritory2Association (User assignments)
│ └── ObjectTerritory2Association (Account assignments)
├── Territory2Rule (Assignment rules)
└── Territory2ObjectExclusion (Assignment blocks)
| State | Modifiable | Active | Notes |
|---|---|---|---|
| Planning | Yes | No | Default for new models |
| Active | Limited | Yes | Only 1 per org |
| Archived | No | No | Read-only, permanent |
| Cloning | No | No | Temporary during clone |
| Level | Account | Opp/Case/Contact |
|---|---|---|
None | N/A | No access |
Read | View only | View only |
Edit | View + Edit | View + Edit |
All | Full control | N/A |
| Cause | Description |
|---|---|
Territory2Manual | Manual assignment |
Territory2Rule | Assignment rule |
Territory2Api | API/programmatic |
| Phase | Focus | Key Actions |
|---|---|---|
| 0. Pre-flight | Validation | Check permissions, model state, feature enabled |
| 1. Discovery | Analysis | Query current state, map hierarchy, analyze coverage |
| 2. Design | Planning | Structure hierarchy, define types, plan rules |
| 3. Validation | Verification | Check uniqueness, references, no cycles |
| 4. Checkpoint | Backup | Capture current state for rollback |
| 5. Execution | Deployment | Create/update/delete with chunking |
| 6. Assignment | Routing | Assign users and accounts |
| 7. Verification | Confirmation | Validate deployment, generate report |
| Need | Agent | Trigger |
|---|---|---|
| Full orchestration | sfdc-territory-orchestrator | Complex, multi-phase |
| Read-only analysis | sfdc-territory-discovery | Discovery, health check |
| Structure design | sfdc-territory-planner | Design, planning |
| Execute changes | sfdc-territory-deployment | Deploy, CRUD |
| User/account assignment | sfdc-territory-assignment | Assignments |
| Monitor operations | sfdc-territory-monitor | Status, logs |
Score = (territories / 100) * 0.2 +
(depth / 7) * 0.15 +
(users / 500) * 0.2 +
(accounts / 10000) * 0.2 +
(rules / 20) * 0.15 +
(hasOverlap ? 0.1 : 0)
Thresholds: <0.3 (Simple), 0.3-0.7 (Moderate), >0.7 (Complex)
# Query models
sf data query --query "SELECT Id, Name, State FROM Territory2Model" --target-org $ORG
# Create territory
sf data create record --sobject Territory2 \
--values "Name='...' DeveloperName='...' Territory2ModelId='...' Territory2TypeId='...' AccountAccessLevel='Edit'" \
--target-org $ORG
# Assign user
sf data create record --sobject UserTerritory2Association \
--values "UserId='...' Territory2Id='...' RoleInTerritory2='...'" \
--target-org $ORG
# Assign account
sf data create record --sobject ObjectTerritory2Association \
--values "ObjectId='...' Territory2Id='...' AssociationCause='Territory2Manual'" \
--target-org $ORG
| Limit | Value |
|---|---|
| Models per org | 4 |
| Active models | 1 |
| Territories per model | 99,999 |
| Bulk batch size | 200 |
methodology.md - Detailed 7-phase workflowdata-quality-protocol.md - Validation requirementserror-taxonomy.md - Common errors and recoveryhierarchy-design-patterns.md - Design patternsimplementation-checklist.md - Pre-deployment gates