Skip to content

Latest commit

 

History

History
93 lines (59 loc) · 2.44 KB

File metadata and controls

93 lines (59 loc) · 2.44 KB
title Territory
description Territory protocol schemas

{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}

Territory Management Protocol

Defines a matrix reporting structure that exists parallel to the

business-unit hierarchy (ADR-0090 D3 — the org tree is sys_business_unit).

USE CASE:

  • Enterprise Sales Teams (Geo-based: "EMEA", "APAC")

  • Industry Verticals (Industry-based: "Healthcare", "Financial")

  • Strategic Accounts (Account-based: "Strategic Accounts")

DIFFERENCE FROM THE BUSINESS-UNIT TREE:

  • Business unit: Hierarchy of PEOPLE (org structure). Stable. HR-driven.

  • Territory: Hierarchy of ACCOUNTS/REVENUE (Who owns which market). Flexible. Sales-driven.

  • One User can be assigned to MANY Territories (Matrix).

  • One User belongs to one primary business unit (Tree).

**Source:** `packages/spec/src/security/territory.zod.ts`

TypeScript Usage

import { Territory, TerritoryModel, TerritoryType } from '@objectstack/spec/security';
import type { Territory, TerritoryModel, TerritoryType } from '@objectstack/spec/security';

// Validate data
const result = Territory.parse(data);

Territory

Properties

Property Type Required Description
name string Territory unique name (lowercase snake_case)
label string Territory Label (e.g. "West Coast")
modelId string Belongs to which Territory Model
parent string optional Parent Territory
type Enum<'geography' | 'industry' | 'named_account' | 'product_line'>
assignmentRule string optional Criteria based assignment rule
assignedUsers string[] optional
accountAccess Enum<'read' | 'edit'>
opportunityAccess Enum<'read' | 'edit'>
caseAccess Enum<'read' | 'edit'>

TerritoryModel

Properties

Property Type Required Description
name string Model Name (e.g. FY24 Planning)
state Enum<'planning' | 'active' | 'archived'>
startDate string optional
endDate string optional

TerritoryType

Allowed Values

  • geography
  • industry
  • named_account
  • product_line