---
title: Distribution Groups
slug: distribution-groups
createdAt: 2025-04-01T23:13:24.265Z
---

# Introduction

This document provides comprehensive documentation for the **Distribution Groups** feature. Distribution Groups are fundamental to managing targeted communications and notifications within the system. They function as curated contact lists, ensuring that the right individuals receive relevant information based on their roles, responsibilities, or location affiliations.

This feature incorporates a robust system of defaults and customization:

- **System-Level Defaults:** Pre-configured groups are established at the highest administrative level (referred to as "CommandIT"), serving as a baseline for all organizations.
- **Organizational Customization:** Managed Service Providers (MSPs) and direct Customers can tailor these groups to meet their specific needs or the needs of their clients. Customization employs a "copy-on-write" mechanism, preserving the integrity of the original system defaults.

This document details the concept, hierarchical structure, customization workflow, user interface interactions, and the underlying database schema associated with Distribution Groups.

***

# Overview of Distribution Groups

At its core, a Distribution Group is simply a named list of contacts designated to receive specific notifications or communications generated by the system (e.g., alerts, reports, incident updates).

**Key Concepts:**

- **System Defaults (CommandIT Level):** The system defines a standard set of Distribution Groups. These are identified in the database by having a `NULL` value in the `organization_id` field. They act as the foundational templates.
- **Inheritance & Customization:**
  - **Customers with no parent MSP:** These organizations inherit the system-level defaults directly. They can use them as-is or choose to customize them.
  - **Managed Service Providers (MSPs):** MSPs also inherit the system-level defaults but typically customize them extensively to manage communications for their various clients.
- **Copy-on-Write Mechanism:** When an organization (MSP or Customer) modifies a Distribution Group (e.g., renames it, adds/removes contacts, deletes it), the system *does not* alter the original system-level group. Instead, it creates a *new* record specifically for that organization, marked with their unique `organization_id`. This ensures organizational autonomy and protects the system defaults.
- **Protected System Groups:** Certain crucial system-level groups, like the **Major Incident Stakeholders** group, are flagged as non-editable and non-deletable (`is_editable = FALSE`). This protection is vital because these groups are often tied to critical automated system functions (e.g., triggering notifications when a high-priority "Major Incident" ticket is created).

***

# Hierarchical Structure and Assignment

Distribution Groups leverage the system's organizational and location hierarchy to enable highly targeted communication. This structure allows groups to be defined or assigned at various levels, ensuring messages reach the appropriate audience based on scope.

**Typical Hierarchy Example:**

1. **CommandIT (System Level -&#x20;**`organization_id`**&#x20;is NULL)**
   - Defines system-wide default groups.
2. **Managed Service Provider (Organization -&#x20;**`organization_type`**&#x20;= "msp")**
   - Can customize system groups or create new ones specific to their operations.
   - *Manages:*
     - **Client Company #1 (Organization -&#x20;**`organization_type`**&#x20;= "client")**
       - Can inherit groups from MSP/CommandIT or have custom groups defined by the MSP or themselves.
       - **Location #1 (e.g., HQ)**
         - Groups can be assigned here for location-specific comms.
         - **Building #1**
           - Groups can be assigned here.
           - **Wiring Closet A**
             - Highly specific groups can be assigned here.
3. *or* **Customer without parent MSP**
   - Inherits CommandIT settings directly unless customized.
   - Follows a similar location hierarchy as clients under an MSP.

**Assignment Flexibility:** Distribution Groups can be associated with any level in this hierarchy, from the top-level organization down to the most granular sub-location, providing precise control over notification delivery.

***

# Key Features Explained

## System-Level Groups (Defaults)

- **Purpose:** Provide a consistent baseline set of communication groups across the entire system.
- **Identification:** Defined by a `NULL` `organization_id` in the database.
- **Protection Mechanism:** Critical system groups (e.g., **Major Incident Stakeholders**) are marked with `is_editable = FALSE`. This prevents accidental modification or deletion that could disrupt essential system processes like automated incident notifications.

## Organizational Customization

- **Mechanism:** Utilizes a "copy-on-write" approach. When an MSP or Customer Admin modifies a default group, a new group record is created linked to their `organization_id`.
- **Benefits:**
  - **Preserves Defaults:** System-level templates remain untouched and available for other organizations or future reference.
  - **Tailored Communication:** Allows each organization to adapt groups (membership, naming) to their specific structure and needs.
  - **Autonomy:** Empowers organizations to manage their communications independently.
- **Inheritance:** Organizations initially see and can use the system-level defaults. Customization overrides the default for that specific organization.

## Multi-Level Hierarchy Support

- **Scope:** Distribution Groups can be assigned contextually based on the organizational and location hierarchy.
- **Granularity:** Allows for broad communication (e.g., all users in an organization) or highly specific communication (e.g., network team contacts for a specific wiring closet).
- **Nesting:** The `parent_group_id` field allows for creating nested Distribution Groups, enabling complex relationship modeling (e.g., a "Regional IT" group containing "Site A IT" and "Site B IT" sub-groups). This supports an theoretically infinite depth of nesting for sophisticated communication structures.

***

# Common Use Cases & System Behavior

This table illustrates how common actions affect Distribution Group records:

| **Action**                | **Performed By**        | `organization_id`**&#x20;Involved** | **Resulting System State**                                                                                                                                                                                              |
| ------------------------- | ----------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| View Default Groups       | Any User                | N/A (viewing `NULL` org\_id)        | UI displays system-level groups. Groups flagged `is_editable = FALSE` appear read-only.                                                                                                                                 |
| Rename a Default Group    | MSP / Customer IT Admin | Their Org ID                        | A *new* group record is created with the User's `organization_id` and the new name. The original system-level group (with `NULL` org\_id) remains unchanged.                                                            |
| Add Contacts to a Group   | MSP / Customer IT Admin | Their Org ID                        | If modifying a default group, a *new* record is created under the User's `organization_id` with the added contacts. If modifying an existing custom group owned by the org, that record is updated.                     |
| Delete a Default Group    | MSP / Customer IT Admin | Their Org ID                        | If a customized copy exists for their org, that copy is deleted. The original system-level group (with `NULL` org\_id) remains untouched and visible. If deleting a group created *by* the organization, it is removed. |
| Delete a Protected Group  | Any User                | N/A                                 | Action is disallowed by the UI/backend because `is_editable = FALSE`. System-level protected groups cannot be deleted.                                                                                                  |
| Create a New Custom Group | MSP / Customer IT Admin | Their Org ID                        | A new group record is created directly under the User's `organization_id`. It is not linked to a system-level default.                                                                                                  |

***

# User Interface (UI) Flow

1. **Initial View:** When accessing the Distribution Groups page, the UI displays a consolidated list. This list includes:
   - System-level default groups (`organization_id = NULL`).
   - Any custom groups already created by or for the user's organization (`organization_id` matches user's org).
   - System groups marked as non-editable/non-deletable (`is_editable = FALSE`) will have editing/deleting controls disabled or hidden.
2. **Editing/Customizing:**
   - When an administrator (MSP or Customer IT) selects a *system-level* group and initiates an edit (e.g., clicks "Rename," "Add Contact," or "Delete"):
     - The system intercepts this action.
     - It creates a *new* Distribution Group record associated with the administrator's `organization_id`.
     - The specific change (rename, adding contacts) is applied to this *new* record. If the action was "Delete", the *customized copy* is deleted (if it exists); the system default remains.
   - If editing a group *already customized* or created by the organization, the changes are applied directly to that existing organizational record.
3. **Assignment:**
   - Distribution Groups (both system-level and custom) can be associated with entities within the Organization/Location hierarchy (e.g., assigning a "Building Maintenance" group to a specific Building record).
   - This assignment dictates which group receives notifications related to events or items linked to that specific hierarchical entity.

***

# Database Table Structure

### `distributionGroups` Table

This table stores the definitions for all Distribution Groups within the system.

*(Note: UUID/Int indicates the data type might be a Universally Unique Identifier or an Integer depending on the specific database implementation.)*

| Column Name       | Data Type | Constraints                | Description                                                                                                                                    |
| ----------------- | --------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `group_id`        | UUID/Int  | Primary Key, Not Null      | Unique identifier for each distribution group record.                                                                                          |
| `organization_id` | UUID/Int  | Nullable, Foreign Key      | Identifier of the organization that owns this specific group record. If `NULL`, this is a system-level (CommandIT) default group.              |
| `parent_group_id` | UUID/Int  | Nullable, Foreign Key      | Identifier of the parent group, enabling hierarchical nesting of groups. `NULL` indicates a top-level group.                                   |
| `name`            | VARCHAR   | Not Null                   | The display name of the distribution group (e.g., "Network Admins," "Site Contacts").                                                          |
| `description`     | TEXT      | Nullable                   | Optional field for providing more context or details about the group's purpose or membership criteria.                                         |
| `is_editable`     | BOOLEAN   | Not Null, Default: `TRUE`  | Flag indicating if the group can be modified or deleted. Set to `FALSE` for protected system-level groups (where `organization_id` is `NULL`). |
| `created_at`      | TIMESTAMP | Not Null, Default: `NOW()` | Timestamp indicating when the group record was initially created.                                                                              |
| `updated_at`      | TIMESTAMP | Nullable                   | Timestamp indicating the last time the group record was modified. `NULL` if never updated.                                                     |

### Example Database Entries

**1. System-Level Protected Group:**

| group\_id | organization\_id | parent\_group\_id | name                        | description                                                       | is\_editable | created\_at         | updated\_at |
| --------- | ---------------- | ----------------- | --------------------------- | ----------------------------------------------------------------- | ------------ | ------------------- | ----------- |
| `sys_001` | `NULL`           | `NULL`            | Major Incident Stakeholders | Critical group notified on Major Incidents via system automation. | `FALSE`      | 2025-01-10 08:00:00 | `NULL`      |

**2. Customized Group for an Organization (e.g., MSP):**
*(This might be a copy of a system default, now customized)*

| group\_id  | organization\_id | parent\_group\_id | name                 | description                                                    | is\_editable | created\_at         | updated\_at         |
| ---------- | ---------------- | ----------------- | -------------------- | -------------------------------------------------------------- | ------------ | ------------------- | ------------------- |
| `cust_101` | `org_abc`        | `NULL`            | Alpha MSP IT Support | Primary IT support contacts for Alpha MSP internal operations. | `TRUE`       | 2025-04-01 10:30:00 | 2025-04-01 11:15:00 |

**3. Custom Group Created by an Organization:**

| group\_id  | organization\_id | parent\_group\_id | name                   | description                                          | is\_editable | created\_at         | updated\_at |
| ---------- | ---------------- | ----------------- | ---------------------- | ---------------------------------------------------- | ------------ | ------------------- | ----------- |
| `cust_102` | `org_xyz`        | `NULL`            | Client Beta Onboarding | Contacts involved in onboarding Client Beta project. | `TRUE`       | 2025-03-15 14:00:00 | `NULL`      |

