Division Validation Rules¶
Division validation rules ensure data integrity and consistency across your system's hierarchical entity structures. These rules govern how divisions can be assigned, modified, and removed throughout parent-child relationships, preventing orphaned entities and maintaining valid division configurations.
Understanding these validation constraints is essential when managing divisions across programs, rules, policies, and other dependent entities, as the system enforces strict parent-child relationship validation to protect your operational structure.
Parent-Child Relationship Validation¶
The system enforces division consistency across entity hierarchies:
- Rules must have divisions supported by their parent Program and Rule Folder
- Reward Policies: Referenced segments and tier policies must have all reward policy divisions
- Rules: Referenced segments and tier policies must have all rule divisions
- Streak Policies: Selected segments must have all streak policy divisions
Division Deactivation¶
Division Deactivation Constraints
You can't remove divisions from parent entities if doing so would leave child entities with divisions that are no longer supported by the parent. The system ensures parent-child division relationships remain valid after any division removal.
Validation Logic¶
When attempting to remove divisions from a parent entity, the system performs hierarchy-aware validation:
- Calculate Parent's Remaining Divisions: Determines what divisions the parent would have after removal
- Empty Divisions Bypass: If the parent would have no divisions after removal, validation is bypassed entirely
- Orphaned Division Detection: Uses hierarchy expansion to identify divisions that children might have but parent won't support
- Child Entity Validation: Only checks for child entities that have the potentially orphaned divisions
Example Scenarios
| Parent Divisions | Divisions to Remove | Child Entity Divisions | Result |
|---|---|---|---|
| [A, B, C] | [A] | [B] (child exists) | ✅ Allowed - Child's division B still supported |
| [A, B] | [A, B] | [C] (child exists) | ✅ Allowed - Parent has empty divisions, bypasses validation |
| [A, B] | [A] | [A] (child exists) | ❌ Blocked - Child would have unsupported division A |
Hierarchy Expansion¶
- Uses division hierarchy to compute orphaned divisions across parent-child relationships.
- Prevents removal only when specific orphaned divisions are found in child entities.
- A more targeted validation than checking all child data.
When attempting to remove divisions from a parent entity, refer to Table 1 for protected entities.
Table 1. Protected child entities
| Parent Entity | Protected Child Entities |
|---|---|
| Program | RewardPolicy, PursePolicy, TierPolicy, AggregatePolicy, Member, Partner, StreakPolicy, RuleFolder, Rule, Flow, CustomExpression |
| RewardPolicy | Offer, Reward |
| Segment | MemberSegment, RewardPolicy (segments), Rule (segments), StreakPolicy |
| PursePolicy | AccrualItem, RedemptionItem |
| StreakPolicy | StreakHistory |
| AggregatePolicy | DailyAggregate, WeeklyAggregate, MonthlyAggregate, QuarterlyAggregate, HalfYearlyAggregate, YearlyAggregate, LifetimeAggregate |
| RuleFolder | Rule, RuleFolder (nested) |
| Reward | RewardUsageHistory |
| Offer | OfferUsageHistory |
Streak Rule Division Protection
Divisions for streak rules can't be changed or removed.
Inactive Division Behavior¶
The RCX system manages division status through the isActive flag, which
controls access at the authentication level:
Division Status¶
- Default State: All divisions are created with
isActive: falseby default - Activation: Divisions must be explicitly set to
isActive: truefor user access - Status Management: Division status can be toggled through the administrative interface
Table 2. System Behavior
| Level | Behavior |
|---|---|
| User Authentication | Users assigned to inactive divisions (isActive: false) can't log into the system |
| API Responses | Entities belonging to inactive divisions continue to appear in API responses |
| Database Queries | Queries return entities associated with inactive divisions |
| Entity Access | Existing entities assigned to inactive divisions remain accessible to authenticated users * |
* Users must belong to an active parent division or to no division at all.
Authentication Process¶
- When a user attempts to log in, the system validates their assigned division's
isActivestatus. - If the division is inactive (
isActive: false), authentication fails with error code 1108. - Users must be reassigned to an active division or the division must be reactivated for login access.
Data Access¶
- Once authenticated with an active division, users can access entities that reference inactive divisions.
- Division-based filtering applies to division membership, not division activity status.
- Entities assigned to inactive divisions remain visible in search results and API responses.
See also: