---
title: Task reference code lookups
summary: Reads the action, category, priority, and source-system code tables that back task validation, defaults, and display, and resolves the code/enum mappings consuming task types rely on.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.Tasks
reference_type: package
operation_id: OP-TASK-04
trigger: Caller reads one code row, a full lookup collection, or a code/enum mapping helper
---

# Task reference code lookups

Four parallel, near-identical code-table object pairs — `clsTaskActionCode`/`clsTaskActionCodeCollection`, `clsTaskCategoryCode`/`clsTaskCategoryCodeCollection`, `clsTaskPriorityCode`/`clsTaskPriorityCodeCollection`, and `clsTaskSourceCode`/`clsTaskSourceCodeCollection` — provide read-only access to the `TASK_ACTION_CODE`, `TASK_CATEGORY_CODE`, `TASK_PRIORITY_CODE`, and `TASK_SOURCE_CODE` tables respectively. Each pair follows the same BOF code-table pattern (single-row `GetCode`/lookup-by-key and full-collection `GetCodes`), so they are documented as one merged operation. The source and priority collections additionally expose static helpers that translate between database codes and the `TaskSourceSystem`/`TaskPriority` enums used throughout the task object model.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-TASK-04 |
| **Trigger** | A caller requests a single code row (`GetCode`) or a full collection (`GetCodes`) for any of the four code types, or calls a source/priority enum-mapping helper |
| **Inputs** | Optional code key (action code, category code + source code, priority code, source code); for collection reads, an optional source-code filter (category codes only) |
| **Outputs** | A single populated code object, or a collection of code objects ordered by description; for the enum helpers, a resolved `TaskSourceSystem`/`TaskPriority` value or its corresponding database code |
| **Primary components** | `clsTaskActionCode.GetCode`, `clsTaskActionCodeCollection.GetCodes`, `clsTaskCategoryCode.GetCode`, `clsTaskCategoryCodeCollection.GetCodes`, `clsTaskPriorityCode.GetCode`, `clsTaskPriorityCodeCollection.GetCodes`, `clsTaskPriorityCodeCollection.Priority`, `clsTaskSourceCode.GetCode`, `clsTaskSourceCodeCollection.GetCodes`, `clsTaskSourceCodeCollection.TaskSource`, `clsTaskSourceCodeCollection.TaskSourceCode` |
| **Entry point** | `Business\SAIF.Business.Tasks\clsTaskActionCode.vb`, `clsTaskActionCodeCollection.vb`, `clsTaskCategoryCode.vb`, `clsTaskCategoryCodeCollection.vb`, `clsTaskPriorityCode.vb`, `clsTaskPriorityCodeCollection.vb`, `clsTaskSourceCode.vb`, `clsTaskSourceCodeCollection.vb` |

## Steps

1. **Single action-code lookup.** `clsTaskActionCode.GetCode(dpi, code)` builds a criteria keyed by `Code` and retrieves one row via `TASK_ACTION_CODE.CODE = :Code` ([SQL-003](../sql/SQL-003-task-action-code-by-code.md), [TASK_ACTION_CODE](../database-tables.md#task_action_code)), filling `Code` and `Description`.
2. **Action-code collection.** `clsTaskActionCodeCollection.GetCodes(dpi)` retrieves the full `TASK_ACTION_CODE` table ordered by description ([SQL-004](../sql/SQL-004-task-action-code-list.md), [TASK_ACTION_CODE](../database-tables.md#task_action_code)) and materializes one `clsTaskActionCode` per row.
3. **Single category-code lookup.** `clsTaskCategoryCode.GetCode(dpi, sourceSystem, code)` builds a criteria keyed by both `Code` and `TaskSourceCode` and retrieves one row via `TASK_CATEGORY_CODE.CODE = :Code AND TASK_CATEGORY_CODE.TASK_SOURCE_CODE = :TaskSourceCode` ([SQL-006](../sql/SQL-006-task-category-code-by-source-and-code.md), [TASK_CATEGORY_CODE](../database-tables.md#task_category_code)), filling `Code`, `Description`, `DefaultActionCode`, `DefaultPriorityCode`, `NotepadFlag`, and `TaskSourceCode`.
   - The `NotepadFlag` value drives `IsNotePadRequired`, which reports `True` only when the flag equals `Y`, and which concrete task types surface through the `RequiresNotePadEntry` contract ([BR-011](../business-rules.md#br-011-category-notepad-requirement-is-surfaced-to-callers)).
4. **Category-code collection filtered by source.** `clsTaskCategoryCodeCollection.GetCodes(dpi, sourceCode)` retrieves every category row for one source system, ordered by description ([SQL-007](../sql/SQL-007-task-category-code-list-by-source.md), [TASK_CATEGORY_CODE](../database-tables.md#task_category_code)), and sets `IsValid = True` on the collection only if at least one row was found.
5. **Single priority-code lookup.** `clsTaskPriorityCode.GetCode(dpi, code)` retrieves one `TASK_PRIORITY_CODE` row by code ([SQL-009](../sql/SQL-009-task-priority-code-by-code.md), [TASK_PRIORITY_CODE](../database-tables.md#task_priority_code)).
6. **Priority-code collection.** `clsTaskPriorityCodeCollection.GetCodes(dpi)` retrieves the full `TASK_PRIORITY_CODE` table ordered by description ([SQL-010](../sql/SQL-010-task-priority-code-list.md), [TASK_PRIORITY_CODE](../database-tables.md#task_priority_code)).
   - The collection also exposes `Priority(code)` and `Priority(taskPriority)`, static helpers that map the literal codes `INFO`/`LOW`/`MED`/`HIGH`/`URG` to and from the `TaskPriority` enum (defaulting to `Informational` for an unrecognized code or enum value); these constants back the priority-level cascade used by [task collection retrieval](task-collection-retrieval.md).
7. **Single source-code lookup.** `clsTaskSourceCode.GetCode(dpi, code)` retrieves one `TASK_SOURCE_CODE` row by code ([SQL-011](../sql/SQL-011-task-source-code-by-code.md), [TASK_SOURCE_CODE](../database-tables.md#task_source_code)).
8. **Source-code collection.** `clsTaskSourceCodeCollection.GetCodes(dpi)` retrieves the full `TASK_SOURCE_CODE` table ordered by description ([SQL-012](../sql/SQL-012-task-source-code-list.md), [TASK_SOURCE_CODE](../database-tables.md#task_source_code)).
   - The collection also exposes `TaskSource(code)` and `TaskSourceCode(sourceSystem)`, static helpers that map the fourteen literal source codes (`AV`, `BATCH`, `CBP`, `CLAIM`, `CLMC`, `COVB`, `CLMM`, `IMAGE`, `LEGAL`, `PROV`, `RTW`, `THRDP`, `TITAN`, `WCIS`) to and from the `TaskSourceSystem` enum; an unrecognized code resolves to `TaskSourceSystem.NotAssigned`. This mapping is what [task collection retrieval](task-collection-retrieval.md)'s row-materialization step uses to name an unsupported source system in its thrown exception.

## Process flow

```mermaid
flowchart TD
	Start([Caller requests a code<br>row or collection]) --> Which{Which code type?}
	Which -->|Action| ActLookup[GetCode / GetCodes<br>against TASK_ACTION_CODE]
	Which -->|Category| CatLookup[GetCode by source+code /<br>GetCodes by source<br>against TASK_CATEGORY_CODE]
	Which -->|Priority| PriLookup[GetCode / GetCodes<br>against TASK_PRIORITY_CODE]
	Which -->|Source| SrcLookup[GetCode / GetCodes<br>against TASK_SOURCE_CODE]
	CatLookup --> Notepad{NotepadFlag = 'Y'?}
	Notepad -->|Yes| NotepadTrue([IsNotePadRequired = True])
	Notepad -->|No| NotepadFalse([IsNotePadRequired = False])
	PriLookup --> PriMap[Priority helpers map<br>code <-> TaskPriority enum]
	SrcLookup --> SrcMap[TaskSource helpers map<br>code <-> TaskSourceSystem enum]
	ActLookup --> Return([Object or collection returned])
	NotepadTrue --> Return
	NotepadFalse --> Return
	PriMap --> Return
	SrcMap --> Return
```

## Failure and edge-case behavior

- All four lookup pairs are read-only: none implement add, remove, or save behavior on the code tables themselves.
- A single-row lookup with no matching code (action, category, priority, or source) leaves the object unfilled rather than raising an explicit not-found error, mirroring the retrieval behavior in the [task record lifecycle](task-record-lifecycle.md).*
- `clsTaskCategoryCodeCollection` is the only one of the four collections that tracks `IsValid` based on whether any row was found for the requested source code; the other three collections do not expose an equivalent found/not-found signal.
- `TaskSource(code)` and `Priority(code)` both silently default to a safe fallback value (`NotAssigned` and `Informational` respectively) for an unrecognized code rather than raising an error, so a bad or new database code degrades to a default classification instead of failing loudly.

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

## Sources
- `Business\SAIF.Business.Tasks\clsTaskActionCode.vb`
- `Business\SAIF.Business.Tasks\clsTaskActionCodeCollection.vb`
- `Business\SAIF.Business.Tasks\clsTaskCategoryCode.vb`
- `Business\SAIF.Business.Tasks\clsTaskCategoryCodeCollection.vb`
- `Business\SAIF.Business.Tasks\clsTaskPriorityCode.vb`
- `Business\SAIF.Business.Tasks\clsTaskPriorityCodeCollection.vb`
- `Business\SAIF.Business.Tasks\clsTaskSourceCode.vb`
- `Business\SAIF.Business.Tasks\clsTaskSourceCodeCollection.vb`
