Atlas Forms
Tenant FormID Ranges
Tenant-specific forms (additions) need FormIDs that do not collide with the global group range or with any other tenant. The convention is tenantId × 100000 + groupRangeStart. This formula produces a unique, predictable 100-ID range for each tenant per group.
The Formula
// Tenant private FormID range for a specific group:
// rangeStart = tenantId × 100000 + groupRangeStart
// rangeEnd = rangeStart + 99
// Example: Tenant 9, GuardRails group (groupRangeStart = 13000)
rangeStart = 9 × 100000 + 13000 = 913000
rangeEnd = 913000 + 99 = 913099
// FormIDs 913000–913099 are private to Tenant 9 in the GuardRails group
Examples
| TenantID | Group | Group Start | Tenant Range Start | Tenant Range End |
|---|---|---|---|---|
| 9 | GuardRails | 13000 | 913000 | 913099 |
| 9 | NodePolicies | 14000 | 914000 | 914099 |
| 12 | GuardRails | 13000 | 1213000 | 1213099 |
| 42 | WorkDesk | 15000 | 4215000 | 4215099 |
| 100 | GuardRails | 13000 | 10013000 | 10013099 |
Why This Formula?
The formula creates a namespace that is:
- Deterministic — given a tenantId and groupStart, the range is always the same; no coordination needed
- Collision-free — global group ranges are below 100000; tenant ranges start at tenantId × 100000 which is always ≥ 100000
- Human-readable — a FormID of 913008 is obviously "Tenant 9's GuardRails form #8" at a glance
- Cross-group isolated — Tenant 9's GuardRails range (913000) and Tenant 9's NodePolicies range (914000) never overlap
Computing the Range in Code
function tenantGroupRange(tenantId: number, groupRangeStart: number): { start: number; end: number } {
const start = tenantId * 100000 + groupRangeStart;
return { start, end: start + 99 };
}
// Examples
tenantGroupRange(9, 13000) // → { start: 913000, end: 913099 }
tenantGroupRange(12, 13000) // → { start: 1213000, end: 1213099 }
tenantGroupRange(9, 14000) // → { start: 914000, end: 914099 }
Tenant FormID in the Atlas_Forms Row
-- Tenant addition row: FormID is in the tenant range, TenantID is set
INSERT INTO [dbo].[Atlas_Forms]
([FormID], [FormCode], [FormCategoryID], [FormTypeID],
[PrimaryUsage], [NodeUsage], [TenantID], [IsActive], [SchemaJson])
VALUES
(913001, 'Acme_GuardRail_GdprConsent_Edit', 130, 2,
'guardrails', 'acme-guardrail-gdpr-consent', 9, 1, N'{...}');
-- The FormCategoryID (130) remains the same — this form belongs to the GuardRails group
-- The TenantID (9) marks it as a private tenant form
Tenant FormIDs Are Never Global
A FormID of 913001 with
TenantID = 9 is only accessible when a request is made in the context of Tenant 9. The form loader always filters by TenantID, so there is no risk of Tenant 9's private forms appearing in Tenant 12's session.