---
title: SAIF.Business.Tasks operations and processes
summary: Operation catalog and cross-operation hub for the reusable task lifecycle and reference-data operations exposed by SAIF.Business.Tasks.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.Tasks
reference_type: package
---

# SAIF.Business.Tasks operations and processes

This page is the operation catalog and cross-operation hub for `SAIF.Business.Tasks`. The library provides the shared, reusable base implementation that concrete task types across the SAIF ecosystem inherit: an in-memory-to-Oracle CRUD lifecycle for a single task through the `pk82036_task` package, a dynamic multi-filter search over the `TASK` table, a direct-to-package purge of aged soft-deleted rows, and read-only access to the action/category/priority/source reference code tables that back task defaults, validation, and display. Each operation's detailed, step-by-step logic lives in its own page under `operations/`.

## Operation catalog

| Operation | Intent | Trigger | Inputs | Outputs | Rules | Tables | SQL |
| --- | --- | --- | --- | --- | --- | --- | --- |
| [Task record lifecycle](operations/task-record-lifecycle.md) | Initialize, retrieve, insert, update, and soft-delete a single task through the shared `clsTask` base class | Concrete subclass calls `Create()`, retrieves by `TaskID`, or calls `Save()` on a new/dirty/deleted instance | Task field values, `TaskSeqNum`, `UpdateSeqNum`, acting user | Populated task object; inserted/updated/soft-deleted `TASK` row with rows-affected result; broken rules on validation or contention failure | [BR-001](business-rules.md#br-001-valid-source-and-category-combination), [BR-002](business-rules.md#br-002-task-date-must-be-current-or-future), [BR-003](business-rules.md#br-003-due-date-adjusted-to-a-workday-warning), [BR-004](business-rules.md#br-004-task-category-code-is-required), [BR-005](business-rules.md#br-005-source-system-code-is-required), [BR-006](business-rules.md#br-006-priority-code-is-required), [BR-007](business-rules.md#br-007-mail-id-is-required), [BR-008](business-rules.md#br-008-task-insert-must-affect-one-row), [BR-009](business-rules.md#br-009-task-update-requires-a-current-row-version), [BR-010](business-rules.md#br-010-task-delete-requires-a-current-row-version), [BR-012](business-rules.md#br-012-single-task-retrieval-is-keyed-only-by-task-sequence-number), [BR-013](business-rules.md#br-013-insert-normalizes-zero-claim-ids-to-null), [BR-014](business-rules.md#br-014-insert-normalizes-zero-policy-numbers-to-null), [BR-015](business-rules.md#br-015-new-tasks-start-active-and-versioned-from-zero), [BR-016](business-rules.md#br-016-task-update-requires-a-matching-optimistic-concurrency-token), [BR-017](business-rules.md#br-017-update-normalizes-zero-claim-and-policy-values-to-null), [BR-018](business-rules.md#br-018-successful-updates-always-advance-audit-and-version-fields), [BR-019](business-rules.md#br-019-task-delete-is-implemented-as-a-soft-delete), [BR-020](business-rules.md#br-020-soft-delete-requires-a-matching-optimistic-concurrency-token) | [TASK](database-tables.md#task), [TASK_CATEGORY_CODE](database-tables.md#task_category_code) | [SQL-001](sql/SQL-001-task-insert.md), [SQL-002](sql/SQL-002-task-select.md), [SQL-005](sql/SQL-005-task-category-code-count.md), [SQL-013](sql/SQL-013-task-update.md), [SQL-014](sql/SQL-014-task-delete.md) |
| [Task collection retrieval](operations/task-collection-retrieval.md) | Search `TASK` with a dynamic, additive multi-filter criteria and materialize typed task instances | Caller populates a `clsTaskCollection.Criteria` and calls `GetTasks` | Source/category/priority/date/assignee/claim/policy/action/context filters, row limit, sort | Collection of typed task instances for matching rows | [BR-023](business-rules.md#br-023-task-collection-retrieval-excludes-soft-deleted-tasks-by-default), [BR-024](business-rules.md#br-024-priority-level-filter-cascades-to-include-higher-priority-codes) | [TASK](database-tables.md#task) | [SQL-008](sql/SQL-008-task-filtered-collection-select.md) |
| [Purge deleted tasks](operations/task-purge.md) | Physically remove aged soft-deleted rows for a source/category slice | Caller invokes `clsTaskCollection.PurgeTasks` directly | Source code, category code, keep-days value | Deleted-row count | [BR-021](business-rules.md#br-021-task-purge-is-limited-to-deleted-rows-in-the-requested-source-and-category-slice), [BR-022](business-rules.md#br-022-task-purge-retention-is-enforced-by-whole-day-age) | [TASK](database-tables.md#task) | [SQL-015](sql/SQL-015-task-purge.md) |
| [Task reference code lookups](operations/task-reference-code-lookups.md) | Read action, category, priority, and source-system lookup data, and resolve code/enum mappings | Caller requests one code row, a full lookup collection, or an enum-mapping helper | Optional code key or source-code filter | Lookup entity or collection; resolved `TaskSourceSystem`/`TaskPriority` enum values | [BR-011](business-rules.md#br-011-category-notepad-requirement-is-surfaced-to-callers) | [TASK_ACTION_CODE](database-tables.md#task_action_code), [TASK_CATEGORY_CODE](database-tables.md#task_category_code), [TASK_PRIORITY_CODE](database-tables.md#task_priority_code), [TASK_SOURCE_CODE](database-tables.md#task_source_code) | [SQL-003](sql/SQL-003-task-action-code-by-code.md), [SQL-004](sql/SQL-004-task-action-code-list.md), [SQL-006](sql/SQL-006-task-category-code-by-source-and-code.md), [SQL-007](sql/SQL-007-task-category-code-list-by-source.md), [SQL-009](sql/SQL-009-task-priority-code-by-code.md), [SQL-010](sql/SQL-010-task-priority-code-list.md), [SQL-011](sql/SQL-011-task-source-code-by-code.md), [SQL-012](sql/SQL-012-task-source-code-list.md) |

## Process flow diagram

The following diagram shows how the four operations relate: a concrete task type drives the CRUD lifecycle of an individual task, callers separately search across many tasks, an administrative/batch process purges aged soft-deleted rows, and all of the above draw on the shared reference code tables for defaults, validation, and display.

```mermaid
flowchart TD
	Start([Caller requests task functionality]) --> Which{Which operation?}
	Which -->|Single task| Lifecycle[Task record lifecycle:<br>create, retrieve, insert,<br>update, soft-delete]
	Which -->|Search| Collection[Task collection retrieval:<br>dynamic multi-filter search]
	Which -->|Retention| Purge[Purge deleted tasks:<br>Task_Purge for aged<br>soft-deleted rows]
	Which -->|Lookup| Codes[Task reference code lookups:<br>action, category, priority, source]
	Lifecycle --> Validate{Validation rules pass?}
	Validate -->|No| Errors([Broken rules returned;<br>no DB call for insert/update])
	Validate -->|Yes| Save[Call task_insert / task_update /<br>task_delete via pk82036_task]
	Save --> Concurrency{RowsAffected = 1?}
	Concurrency -->|Yes| Done([Change persisted;<br>object marked clean])
	Concurrency -->|No| Contention([Contention error added])
	Collection --> Materialize[Materialize one typed<br>task instance per row]
	Materialize --> SourceCheck{NewTask factory<br>supports source code?}
	SourceCheck -->|No| Throw([ApplicationException])
	SourceCheck -->|Yes| Loaded([Row loaded into collection])
	Codes --> Ref[Read-only reference data<br>used by Lifecycle and Collection]
	Ref --> Lifecycle
	Ref --> Collection
	Purge --> PurgeExec([Aged, already-deleted rows<br>physically removed])
```

## Database interactions

The following table summarizes which operations read from or write to the database. Per-step SQL and table citations live in each operation's detail page under `operations/`.

| Operation | SQL | Tables | Type |
| --- | --- | --- | --- |
| [Task record lifecycle](operations/task-record-lifecycle.md) | [SQL-001](sql/SQL-001-task-insert.md), [SQL-002](sql/SQL-002-task-select.md), [SQL-005](sql/SQL-005-task-category-code-count.md), [SQL-013](sql/SQL-013-task-update.md), [SQL-014](sql/SQL-014-task-delete.md) | [TASK](database-tables.md#task), [TASK_CATEGORY_CODE](database-tables.md#task_category_code) | Read/Write |
| [Task collection retrieval](operations/task-collection-retrieval.md) | [SQL-008](sql/SQL-008-task-filtered-collection-select.md) | [TASK](database-tables.md#task) | Read |
| [Purge deleted tasks](operations/task-purge.md) | [SQL-015](sql/SQL-015-task-purge.md) | [TASK](database-tables.md#task) | Delete |
| [Task reference code lookups](operations/task-reference-code-lookups.md) | [SQL-003](sql/SQL-003-task-action-code-by-code.md), [SQL-004](sql/SQL-004-task-action-code-list.md), [SQL-006](sql/SQL-006-task-category-code-by-source-and-code.md), [SQL-007](sql/SQL-007-task-category-code-list-by-source.md), [SQL-009](sql/SQL-009-task-priority-code-by-code.md), [SQL-010](sql/SQL-010-task-priority-code-list.md), [SQL-011](sql/SQL-011-task-source-code-by-code.md), [SQL-012](sql/SQL-012-task-source-code-list.md) | [TASK_ACTION_CODE](database-tables.md#task_action_code), [TASK_CATEGORY_CODE](database-tables.md#task_category_code), [TASK_PRIORITY_CODE](database-tables.md#task_priority_code), [TASK_SOURCE_CODE](database-tables.md#task_source_code) | Read |

## Failure and edge-case behavior

- A rows-affected value other than `1` is a hard failure on insert, update, and delete alike in the [task record lifecycle](operations/task-record-lifecycle.md); see that page for the full detail.
- Field-level validation rules (category, source, priority, mail ID, source/category combination, date) can each be silently overridden by a concrete task subclass through `OverrideRules`, so documented validation outcomes assume no subclass override is applied.*
- [Task collection retrieval](operations/task-collection-retrieval.md) builds several filter fragments (task text, task-context values) as literal SQL text rather than bound parameters — a latent risk if caller-supplied values are not otherwise sanitized upstream.*
- [Purge deleted tasks](operations/task-purge.md) bypasses the standard save/validation pipeline entirely and only ever removes rows already marked deleted by the lifecycle operation.
- An unsupported task source code encountered during collection retrieval throws rather than skipping the row, so one bad row can fail an entire search.

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Dependencies](dependencies.md)
- [Business rules](business-rules.md)
- [Database tables](database-tables.md)
- [SQL catalog](sql/index.md)
- [Procedures](procedures/index.md)
- [API reference](api/index.md)
- [Configuration](configuration.md)

## Sources
- `Business\SAIF.Business.Tasks\clsTask.vb`
- `Business\SAIF.Business.Tasks\clsTaskCollection.vb`
- `Business\SAIF.Business.Tasks\clsTaskBusinessRules.vb`
- `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`

## Stored procedure operations

Operations implemented in Oracle stored procedures referenced by this library.

| Operation | Description | Source | Link |
| --- | --- | --- | --- |
| Retrieve task row | Retrieve a single `TASK` row through the package cursor routine. | `pk82036_task.task_select` | [Details](procedures/pk82036_task.md#operations) |
| Insert task row | Insert a new `TASK` row with sequence-based key and audit stamps. | `pk82036_task.task_insert` | [Details](procedures/pk82036_task.md#operations) |
| Update task row | Update mutable task fields and increment the row version. | `pk82036_task.task_update` | [Details](procedures/pk82036_task.md#operations) |
| Soft-delete task row | Mark the row deleted without physical removal. | `pk82036_task.task_delete` | [Details](procedures/pk82036_task.md#operations) |
| Purge deleted task rows | Physically remove aged soft-deleted rows in a source/category slice. | `pk82036_task.task_purge` | [Details](procedures/pk82036_task.md#operations) |
