---
title: "Maintain reference data"
summary: "Maintains lookup, page, and user-to-group reference rows."
status: draft
owner: SAIF documentation team
last_reviewed: 2026-08-17
library: SAIF.Business.Menu
reference_type: package
operation_id: OP-MENU-004
trigger: "Caller maintains lookup or membership data."
---

# Maintain reference data

Maintains lookup, page, and user-to-group reference rows.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-004 |
| **Trigger** | Caller maintains lookup or membership data. |
| **Inputs** | `IDataPortalInfo` plus natural or surrogate keys |
| **Outputs** | Persisted lookup and membership rows |
| **Primary components** | `clsApplicationCode`, `clsMenuCategoryCode`, `clsMenuPage`, `clsMenuSecurityUser` |
| **Entry point** | `SAIF.Business.Menu\clsApplicationCode.vb` |

## Steps

1. Use [SQL-MENU-001](../sql/SQL-MENU-001-delete-application-code.md)-[SQL-MENU-006](../sql/SQL-MENU-006-retrieve-active-application-codes.md) to maintain [BUSONLINE_APPS_CODE](../database-tables.md#busonlineappscode).
2. Use [SQL-MENU-007](../sql/SQL-MENU-007-delete-menu-category-code.md)-[SQL-MENU-011](../sql/SQL-MENU-011-retrieve-all-menu-category-codes.md) to maintain [MENU_CATEGORY_CODE](../database-tables.md#menucategorycode).
3. Use [SQL-MENU-018](../sql/SQL-MENU-018-next-menu-page-sequence.md)-[SQL-MENU-023](../sql/SQL-MENU-023-retrieve-all-menu-pages.md) to maintain [MENU_PAGE](../database-tables.md#menupage).
4. Use [SQL-MENU-031](../sql/SQL-MENU-031-delete-menu-security-user-row.md), [SQL-MENU-032](../sql/SQL-MENU-032-insert-menu-security-user-row.md), [SQL-MENU-033](../sql/SQL-MENU-033-update-menu-security-user-row.md), and [SQL-MENU-034](../sql/SQL-MENU-034-retrieve-all-menu-security-user-rows.md) to maintain [MENU_SECURITY_USER](../database-tables.md#menusecurityuser) user-to-security-group membership rows. The user-scoped retrieval, [SQL-MENU-035](../sql/SQL-MENU-035-retrieve-menu-security-users-for-user.md), is documented separately below because its `:MenuUser` bind variable is not supplied by the code and the retrieval fails rather than return a user's memberships.
5. After every write, rely on the common row-count enforcement in [BR-MENU-001](../business-rules.md#br-menu-001-optimistic-contention-on-write) to detect contention or unexpected failures.
6. The maintained lookup and membership rows later participate in [SQL-MENU-043](../sql/SQL-MENU-043-retrieve-authorized-menu-items-for-user.md) and [SQL-MENU-044](../sql/SQL-MENU-044-retrieve-all-authorized-menu-items.md).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
    Start([Caller maintains reference data]) --> Choose{Which reference set?}
    Choose --> App[Application codes]
    Choose --> Cat[Menu categories]
    Choose --> Page[Menu pages]
    Choose --> User[Security users]
    App --> Verify[Verify row count on writes]
    Cat --> Verify
    Page --> Verify
    User --> Verify
    Verify --> Done([Reference data available to menu workflows])
```

## Failure and edge-case behavior

- The library reads and writes these tables through direct Oracle SQL.
- Row-count mismatches surface through [BR-MENU-001](../business-rules.md#br-menu-001-optimistic-contention-on-write) instead of silently committing inconsistent state.
- The user-scoped security-user retrieval (`clsMenuSecurityUserCollection.GetMenuSecurityUserForUser`, [SQL-MENU-035](../sql/SQL-MENU-035-retrieve-menu-security-users-for-user.md)) has a source-level defect: `BeforeRetrieve` selects the `retrieveForUserSQL` statement, whose `:MenuUser` bind variable is never supplied by the code. As written, this retrieval fails at execution time (e.g., a missing-bind-variable error) rather than return the intended per-user membership rows; only the unfiltered `GetMenuSecurityUserAll` retrieval (SQL-MENU-034) is unaffected.

> **Note:** Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Architecture](../architecture.md)
- [Dependencies](../dependencies.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Security and authorization](../security-authorization.md)
- [Database tables](../database-tables.md)
- [SQL catalog](../sql/index.md)
- [API reference](../api/index.md)

## Sources
- `SAIF.Business.Menu\clsApplicationCode.vb`
