---
title: Retrieve legacy task codes
summary: Loads the full legacy_task_code lookup table into an in-memory collection used to translate legacy task-code values.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.Tasks.Claim
reference_type: package
operation_id: OP-TC-05
trigger: Caller calls clsLegacyTaskCodeCollection.GetLegacyTaskCodeCollection
---

# Retrieve legacy task codes

This operation loads every row of the `legacy_task_code` lookup table into a `clsLegacyTaskCodeCollection`, giving callers an in-memory, indexable set of legacy task-code definitions (category, notepad flag, date/text day thresholds, and run-date usage) for translating legacy task codes into current task attributes. It is a simple, unfiltered, read-only lookup with no create, update, or delete path.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-TC-05 |
| **Trigger** | Caller calls `clsLegacyTaskCodeCollection.GetLegacyTaskCodeCollection(dpi)` |
| **Inputs** | `IDataPortalInfo` only — the retrieve has no filter parameters |
| **Outputs** | Populated `clsLegacyTaskCodeCollection` containing every `legacy_task_code` row as a `clsLegacyTaskCode` |
| **Primary components** | `clsLegacyTaskCodeCollection.GetLegacyTaskCodeCollection`, `clsLegacyTaskCodeCollection.BeforeRetrieve`, `clsLegacyTaskCodeCollection.AfterRetrieve`, `clsLegacyTaskCode.Load`, `clsLegacyTaskCode.Fill` |
| **Entry point** | `Business\SAIF.Business.Tasks.Claim\clsLegacyTaskCodeCollection.vb` |

## Steps

1. The caller invokes `GetLegacyTaskCodeCollection(dpi)`, which calls `dpi.DataAccessLayer.RetrieveObject(New Criteria(dpi))`.
2. `BeforeRetrieve` configures the portal request as a `Text`-type command using `MyCriteria.RetrieveSQL`, which is the fixed statement `select * from legacy_task_code` ([SQL-002](../sql/sql-002-select.md), [legacy_task_code](../database-tables.md#legacy_task_code)).
3. `AfterRetrieve` reads every row from the result set. For each row, it creates a new `clsLegacyTaskCode`, calls `Load(dpi, reader)`, and adds it to the collection.
4. `clsLegacyTaskCode.Load` calls `Fill(reader)`, which populates `CreateDate`, `CreateUser`, `DateDaysNum`, `LegacyTaskCode`, `NotepadFlag`, `TaskCategoryCode`, `TextDaysNum`, `TaskText`, `UpdateDate`, `UpdateUser`, and `UseRunDateFlag` directly from the named reader columns, then sets a `Criteria(dpi, legacyTaskCode)` on the object.
5. The caller looks up individual codes from the returned collection by ordinal `Item(index)` or by code value `Item(legacyTaskCode)`; both are read-only indexers over the in-memory `List`.

## Process flow

The following diagram visualizes the unfiltered lookup-table load.

```mermaid
flowchart TD
	Start([Caller calls GetLegacyTaskCodeCollection]) --> Before[BeforeRetrieve:<br>select * from legacy_task_code]
	Before --> Execute[Portal request executes<br>against Oracle]
	Execute --> After[AfterRetrieve: for each row,<br>create and Load a clsLegacyTaskCode]
	After --> More{More rows?}
	More -->|Yes| After
	More -->|No| Done([Return populated collection])
```

## Failure and edge-case behavior

- The retrieve has no filter parameters and no paging; every row in `legacy_task_code` is loaded on every call.
- The `Criteria` class's `CreateSQL`, `DeleteSQL`, `InsertSQL`, and `UpdateSQL` properties all throw `ApplicationException(clsConstants.Messages.InvalidSQLProperty)`, confirming this object supports only the retrieve path documented here.
- `Item(legacyTaskCode)` and `Contains` both return a default/`False` result for an unmatched code rather than raising an error.

## 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.Tasks.Claim\clsLegacyTaskCode.vb`
- `Business\SAIF.Business.Tasks.Claim\clsLegacyTaskCodeCollection.vb`
