ObjectStackObjectStack

Territory

Territory protocol schemas

Territory Management Protocol

Defines a matrix reporting structure that exists parallel to the Role Hierarchy.

USE CASE:

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

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

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

DIFFERENCE FROM ROLE:

  • Role: Hierarchy of PEOPLE (Who reports to whom). 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 has only ONE Role (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

PropertyTypeRequiredDescription
namestringTerritory unique name (lowercase snake_case)
labelstringTerritory Label (e.g. "West Coast")
modelIdstringBelongs to which Territory Model
parentstringoptionalParent Territory
typeEnum<'geography' | 'industry' | 'named_account' | 'product_line'>
assignmentRulestringoptionalCriteria based assignment rule
assignedUsersstring[]optional
accountAccessEnum<'read' | 'edit'>
opportunityAccessEnum<'read' | 'edit'>
caseAccessEnum<'read' | 'edit'>

TerritoryModel

Properties

PropertyTypeRequiredDescription
namestringModel Name (e.g. FY24 Planning)
stateEnum<'planning' | 'active' | 'archived'>
startDatestringoptional
endDatestringoptional

TerritoryType

Allowed Values

  • geography
  • industry
  • named_account
  • product_line

On this page