---
title: Claim-person audit history
summary: Records and retrieves audit-history entries that capture before/after text for tracked claim-person field changes.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.Claim.Person
reference_type: package
operation_id: OP-PER-09
trigger: Caller creates a new audit-history entry after a tracked field change, or retrieves the audit-history list for a person.
---

# Claim-person audit history

Claim-person audit history records a before/after text snapshot whenever a tracked claim-person field changes — home address, mailing address, home phone, message phone, preferred contact method, language preference, or email address, as enumerated by `CodeMap.AuditTypeCodes`. Each entry is inserted once and is not updated or deleted; the object also exposes a shared code-table lookup that maps audit-type codes to their descriptions.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-PER-09 |
| **Trigger** | Caller creates a `clsClaimPersonAuditHistory` entry (typically alongside a tracked field edit) and saves it, or calls `GetIWAuditHistorys` to list a person's history |
| **Inputs** | `PersonID`, `ClaimID`, `AuditType`/`AuditTypeCode`, `BeforeText`, `AfterText` |
| **Outputs** | A persisted `CL_IW_AUDIT_HISTORY` row with a generated sequence number; a `clsClaimPersonAuditHistoryCollection` of history entries for a person; a shared `AuditTypeCodes` code-table map |
| **Primary components** | `clsClaimPersonAuditHistory.Create`, `clsClaimPersonAuditHistory.BeforeInsert`, `clsClaimPersonAuditHistory.AfterInsert`, `clsClaimPersonAuditHistoryCollection.GetIWAuditHistorys`, `CodeMap.GetAuditTypeCodes` |
| **Entry point** | `Business\SAIF.Business.Claim.Person\clsClaimPersonAuditHistory.vb` |

## Steps

1. **Create a new audit-history entry.** `Create()` assigns the next sequence number from the `CL_IW_AUDIT_HISTORY_SEQ` Oracle sequence through `DataPortalInfo.GetNextSeqNum`.**
2. **Set the audit type.** The `AuditType` property setter translates an `AuditTypeCodes` enum value into its stored code by looking it up in the shared `CodeMap.GetAuditTypeCodes` map, which is itself populated by a query against `CL_IW_AUDIT_TYPE_CODE` ordered by description.**
3. **Insert the entry.** `BeforeInsert` builds an insert request binding the audit-history sequence number, audit-type code, person ID, before/after text (truncated to 500 characters each), a zeroed update number, the current date, the acting user's upper-cased ID, and the claim ID.**
4. **Confirm the insert.** `AfterInsert` checks the rows-affected result; if it is not `1`, it adds an `"Insert Failed"` error message, otherwise it marks the entry old.**
5. **Retrieve a single entry by sequence number.** `BeforeRetrieve`/`AfterRetrieve` select the row matching `IWAuditHistorySeqNum` and fill the object from the returned result set.**
6. **Retrieve all entries for a person.** `clsClaimPersonAuditHistoryCollection.GetIWAuditHistorys` appends a `WHERE CL_IW_AUDIT_HISTORY.PERSON_ID = :PersonID` filter to the shared retrieve statement and loads each row into a `clsClaimPersonAuditHistory` in the collection.**

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
    Start([Tracked field changes or history requested]) --> Which{Create entry or list history?}
    Which -->|Create| Seq[Assign next audit-history sequence number]
    Seq --> SetType[Resolve audit type code]
    SetType --> Insert[Insert audit-history row]
    Insert --> Rows{Insert affected 1 row?}
    Rows -->|No| Fail([Add Insert Failed error])
    Rows -->|Yes| Done([Entry marked old])
    Which -->|List| Query[Query rows for PersonID]
    Query --> Return([Return audit-history collection])
```

## Failure and edge-case behavior

- `AddBusinessRules()` on `clsClaimPersonAuditHistory` is an empty override (a `TODO` remains in source), so this object enforces no rule validation of its own beyond the insert row-count check.
- Only create/insert and retrieve paths are implemented; `UpdateSQL` and `DeleteSQL` both throw `NotImplementedException`, so audit-history rows cannot be edited or removed once written.
- The underlying tables (`CL_IW_AUDIT_HISTORY`, `CL_IW_AUDIT_TYPE_CODE`) are not part of this library's cataloged database-tables documentation set, so no table or SQL-ID cross-reference is available for this operation.**

> **Note:** Statements marked with `**` could not be confirmed against the library's existing SQL
> and database-tables catalog; treat as unknown until those catalogs are extended to cover this
> table.

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

## Sources
- `Business\SAIF.Business.Claim.Person\clsClaimPersonAuditHistory.vb`
