---
title: Persist group associations (insert / update / delete)
summary: Insert, update, or delete group master rows through BOF lifecycle hooks.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Group
reference_type: package
operation_id: OP-003
trigger: Caller saves a group association or the collection
---

# Persist group associations (insert / update / delete)

Persists group master data and enforces the row-count checks used by both singular and collection save paths.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-003 |
| **Trigger** | Caller saves a group association or the collection |
| **Inputs** | — |
| **Outputs** | Rows persisted or generic/contention errors added to the object or collection. |
| **Primary components** | `clsGroupAssociation` and `clsGroupAssociationCollection` persistence overrides |
| **Entry point** | `Business\SAIF.Business.Policy.Group\clsGroupAssociation.vb` |

## Steps

1. `BeforeInsert` binds every `GROUP_ASSOCIATION` column (`:Code`, `:Name`, `:EffectiveDate`, `:GroupTypeCode`, `:GroupPlanCode`, `:GroupRenewalDate`, `:PMSGroupNumber`, address block, `:CreateDate`, `:CreateUser`, `:UpdateDate`, `:UpdateUser` (30), `:PMSGroupSubCode`, `:GroupEnrollForm` (5), `:CodeAcronym` (5), endorsement codes, flags) and executes `INSERT INTO GROUP_ASSOCIATION`.
2. `AfterInsert` checks `RowsAffected`; if `<> 1` it calls `AddErrorMessage("InsertError", "Insert Failed")`, otherwise `MarkOld()`. ([BR-009](../business-rules.md#br-009-insert-must-affect-exactly-one-row))
3. `BeforeUpdate` binds the same columns plus the concurrency key and executes `UPDATE GROUP_ASSOCIATION`; `AfterUpdate` raises `AddErrorMessage("UpdateError", Messages.DBContentionError)` when `RowsAffected <> 1`, otherwise `MarkOld()`. ([BR-009](../business-rules.md#br-009-insert-must-affect-exactly-one-row), [BR-010](../business-rules.md#br-010-update-must-affect-exactly-one-row))
4. `BeforeDelete` executes `DELETE GROUP_ASSOCIATION ... WHERE`; `AfterDelete` raises `AddErrorMessage("DeleteError", Messages.DBContentionError)` when the row count is wrong, otherwise calls **`MarkNew()`** — the deleted instance is returned to the new state rather than discarded. ([BR-011](../business-rules.md#br-011-delete-must-affect-exactly-one-row))
5. The collection variants report generic `"Delete Failed"` / `"Insert Failed"` / `"Update Failed"` messages instead of the contention message. ([BR-012](../business-rules.md#br-012-collection-persistence-reports-generic-failure-messages))
6. Database statements executed or relied on by this operation: [SQL-002](../sql/SQL-002-saif-business-policy-group.md), [SQL-003](../sql/SQL-003-saif-business-policy-group.md), [SQL-010](../sql/SQL-010-saif-business-policy-group.md), [SQL-011](../sql/SQL-011-saif-business-policy-group.md), [SQL-030](../sql/SQL-030-saif-business-policy-group.md), [SQL-031](../sql/SQL-031-saif-business-policy-group.md), [SQL-038](../sql/SQL-038-saif-business-policy-group.md), [SQL-039](../sql/SQL-039-saif-business-policy-group.md); affected tables: [DUAL](../database-tables.md#dual), [GROUP_ASSOCIATION](../database-tables.md#group_association).
   - The update and delete variants [SQL-030](../sql/SQL-030-saif-business-policy-group.md), [SQL-031](../sql/SQL-031-saif-business-policy-group.md), [SQL-038](../sql/SQL-038-saif-business-policy-group.md), and [SQL-039](../sql/SQL-039-saif-business-policy-group.md) are truncated at a bare `Where`.
7. Inherited BOF save behavior validates the object or collection, executes the configured criteria SQL, and surfaces row-count failures back on the business object before the caller continues.†

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
    Start([Trigger]) --> Step1[Build criteria / load state]
    Step1 --> Step2[Apply local business logic]
    Step2 --> Decision{Valid and complete?}
    Decision -->|Yes| Step3[Return data or persist rows]
    Decision -->|No| EndErr([Return BOF validation or SQL-state issues])
    Step3 --> EndOk([Operation completes])
```

## Failure and edge-case behavior

- Collection persistence surfaces generic "Insert Failed" / "Update Failed" / "Delete Failed" messages through [BR-012](../business-rules.md#br-012-collection-persistence-reports-generic-failure-messages).

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.
> Statements marked with `†` were retrieved from dependency library documentation via the Legends CLI RAG service.

## Sources
- `Business\SAIF.Business.Policy.Group\clsGroupAssociation.vb`
