---
title: Load preferences for current user
summary: Loads all preference groups for the authenticated user into memory when a clsPreferences instance is constructed.
status: draft
owner: SAIF Documentation Team
last_reviewed: 2026-08-17
library: SAIF.Presentation
reference_type: package
operation_id: OP-PREF-001
trigger: Instantiating clsPreferences via either public constructor
---

# Load preferences for current user

This operation eagerly populates the in-memory preference cache for the currently authenticated data-portal user whenever a `clsPreferences` instance is constructed, establishing the Oracle connection context used for all subsequent reads and saves on that instance.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-PREF-001 |
| **Trigger** | Constructing a `clsPreferences` instance via either public constructor |
| **Inputs** | `inUserID` (accepted but not used to filter the DB call — see step 2), `inApplication` |
| **Outputs** | A populated `clsPreferences` instance with `_Preferences` containing all `Preference` groups for the current portal user |
| **Primary components** | `clsPreferences.Initialize`, `clsPreferences.Load` |
| **Entry point** | SAIF.Presentation\clsPreferences.vb |

## Steps

1. `Initialize(inUserID, inApplication)` sets `m_Application = inApplication` and initializes `_Preferences` to an empty list.
2. `Load()` constructs `clsMSOracleDataLayer("CLM", AppGlobal.EnvironmentService.GetConfigSetting(EnvironmentConfigKeys.OracleDatabase))` and obtains `m_DPI` via `.DataPortalInfo()`. The constructor's `inUserID` parameter is not passed into this call — the user identity actually used is `m_DPI.UserID` (the data-portal's authenticated user context), not the passed-in `inUserID`* ([BR-PREF-005](../business-rules.md#br-pref-005-fixed-oracle-database-user)).
   - On failure: no error handling exists around this construction; any exception from `clsMSOracleDataLayer` or the environment service propagates uncaught to the caller.
3. Constructs `PreferenceData(m_DPI)` and calls `GetPreferencesForUser(m_DPI.UserID.Trim.ToLower())`, assigning the result to `_Preferences`.
   - This step delegates to logic implemented in `SAIF.Framework.Preferences.PreferenceData`, an external dependency library not present in this repository.

   > **Origin**: The retrieval SQL/BOF logic behind `GetPreferencesForUser` is implemented in `PreferenceData` (`SAIF.Framework.Preferences`) and is out of scope for this library's analysis — its internal steps could not be traced here**.
4. No error handling wraps `Load()` as a whole; exceptions from the data layer propagate to the caller.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([clsPreferences constructed]) --> S1[Initialize sets m_Application and empty _Preferences]
	S1 --> S2[Load constructs clsMSOracleDataLayer with CLM user]
	S2 --> S3[Obtain m_DPI via DataPortalInfo]
	S3 --> S4[PreferenceData.GetPreferencesForUser m_DPI.UserID]
	S4 --> EndOk([_Preferences populated])
```

## Failure and edge-case behavior

- No error handling exists around `Load()`; any exception from `clsMSOracleDataLayer`, the environment service, or `PreferenceData.GetPreferencesForUser` propagates uncaught to the constructor's caller.
- The constructor's `inUserID` parameter is not used to filter the loaded data — the actual user context comes from `m_DPI.UserID`, which may not match the caller's supplied `inUserID`*.

> **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.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- SAIF.Presentation\clsPreferences.vb
