---
title: Retrieve claim tasks
summary: Loads claim tasks through the shared BOF task collection framework and, for the "my tasks" view, masks worker names the caller is not authorized to see.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.Tasks.Claim
reference_type: package
operation_id: OP-TC-01
trigger: Caller invokes clsClaimTaskCollection.GetTasks or clsMyTaskCollection.GetTasks with a populated criteria object
---

# Retrieve claim tasks

This operation loads Claims-source tasks into one of two collection shapes: `clsClaimTaskCollection`, a general-purpose claim-task list sorted by task date and priority, or `clsMyTaskCollection`, a caller-specific "my tasks" list that additionally sorts urgent tasks to the top per claim and masks the worker name on any task that exposes a restricted claim attribute the caller cannot see. Both collections build on the inherited BOF task retrieval pipeline; this library only supplies the Claims task-source filter, the sort order, and (for `clsMyTaskCollection`) the access-based masking.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-TC-01 |
| **Trigger** | Caller invokes `clsClaimTaskCollection.GetTasks(dpi, criteria)` or `clsMyTaskCollection.GetTasks(dpi, criteria)`, or the parameterless `NewTaskCollection(dpi)` factories |
| **Inputs** | `IDataPortalInfo`; a `ClaimTaskCriteria` or `MyTaskCriteria` (task date range, claim/policy filters inherited from `clsTaskCollection.Criteria`) |
| **Outputs** | Populated `clsClaimTaskCollection` or `clsMyTaskCollection`, sorted per collection type; `WorkerName` masked to `"Confidential"` on restricted `clsMyTaskCollection` rows |
| **Primary components** | `clsClaimTaskCollection.GetTasks`, `clsClaimTaskCollection.SortByDefault`, `clsMyTaskCollection.GetTasks`, `clsMyTaskCollection.AfterRetrieve`, `clsMyTaskCollection.setSortOrder`, `clsMyTaskCollection.SortByDefault` |
| **Entry point** | `Business\SAIF.Business.Tasks.Claim\clsClaimTaskCollection.vb` |

## Steps

1. The caller supplies an `IDataPortalInfo` and either a `ClaimTaskCriteria` (for `clsClaimTaskCollection`) or a `MyTaskCriteria` (for `clsMyTaskCollection`).
2. `GetTasks` sets `inSelectionCriteria.DataPortalInfo` and calls `AddTaskSourceSystem(TaskSourceSystem.Claims)` on the criteria, restricting the retrieve to Claims-sourced tasks regardless of what the caller's criteria otherwise specifies.
3. The criteria is passed to `inDataPortalInfo.DataAccessLayer.RetrieveObject`, which executes the inherited BOF collection-retrieve pipeline.
   - Sub-step: the base collection criteria builds the filtered `TASK` query from the caller's date range, claim, policy, and context filters and executes it against Oracle.
   - Sub-step: the base retrieve pipeline reads the result set, instantiates one typed task per row through `NewTask()`, and calls `PostFill()` on each row (see [Claim task lifecycle](claim-task-lifecycle.md), step 3, for what `PostFill` does on a `clsClaimTask`).

   > **Origin**: The filtered collection query and row-materialization pipeline are implemented by `clsTaskCollection` in `SAIF.Business.Tasks`. That library is documented in the previous format, so no per-operation page exists; see [Retrieve task collection](../../saif-business-tasks/operations/task-collection-retrieval.md) in the `SAIF.Business.Tasks` documentation set.
4. For `clsClaimTaskCollection`, once all rows are added the collection is sorted by `SortByDefault()`: task date ascending, then `PriorityCode` ascending.
5. For `clsMyTaskCollection`, `AfterRetrieve` overrides the base row-load loop instead of relying purely on the inherited pipeline:
   - It first resolves four caller-access flags once for the whole retrieve: `ExposureAccess`, `ConflictAccess`, `HealthIssueAccess`, and `SecuredAccess`, from `ClaimServices.HasExposureAccess`, `HasConflictAccess`, `HasCollateralAccess`, and `HasSecureAccess`.

     > **Origin**: The underlying access checks are implemented by `ClaimServices` in `SAIF.BOF.Business`; see [ClaimServices](../../saif-business/api/SAIF.Business/claimservices.md) in the `SAIF.BOF.Business` documentation set.
   - For each reader row, it reads `TaskSourceCode`, creates a task through `NewTask()` (a `clsClaimTask`), and throws an `ApplicationException` naming the unsupported task source if `NewTask()` returns nothing.
   - Otherwise it calls `Task.LoadAfterSort(dpi, reader)` (an internal alias for `Load`) to fill the task, calls `setSortOrder(task)` to compute the task's rank, and adds the task to the collection.
   - If the task's `IsExposure`, `isHealthIssue`, `isHostileWrkr`, or `IsWorkerConflict` flag is true and the matching access flag (`ExposureAccess`, `HealthIssueAccess`, `SecuredAccess`, `ConflictAccess`) is false: it sets `Task.WorkerName = "Confidential"` ([BR-011](../business-rules.md#br-011-restricted-claim-attributes-mask-the-worker-name-on-task-lists)).
   - `setSortOrder` tracks the last claim ID seen; the first task loaded for a new claim ID becomes the sort anchor — if that first task's `PriorityCode` is `"URG"`, every task under that claim ID sorts by that claim's own ID (grouping urgent claims at low sort values), otherwise the claim's tasks sort by a shared large constant (`m_lastNormalNum`) alongside all other non-urgent claims.
   - After all rows are read, `SortByDefault()` sorts the collection by `sortBy` ascending, then `TaskDate` ascending, then `ClaimNum` ascending.

## Process flow

The following diagram visualizes the retrieval and, for "my tasks", the masking path.

```mermaid
flowchart TD
	Start([Caller calls GetTasks]) --> SetSource[AddTaskSourceSystem Claims]
	SetSource --> Retrieve[RetrieveObject executes<br>inherited BOF collection query]
	Retrieve --> Which{Which collection?}
	Which -->|clsClaimTaskCollection| SortDefault[SortByDefault:<br>TaskDate, PriorityCode]
	SortDefault --> Done([Return sorted collection])
	Which -->|clsMyTaskCollection| Access[Resolve Exposure, Conflict,<br>HealthIssue, Secured access flags]
	Access --> Loop[For each row:<br>load task, compute sortBy]
	Loop --> Mask{Restricted flag true<br>and access flag false?}
	Mask -->|Yes| Confidential[WorkerName = Confidential]
	Mask -->|No| NoMask[WorkerName unchanged]
	Confidential --> More{More rows?}
	NoMask --> More
	More -->|Yes| Loop
	More -->|No| SortMy[SortByDefault:<br>sortBy, TaskDate, ClaimNum]
	SortMy --> Done
```

## Failure and edge-case behavior

- If a retrieved row's `TaskSourceCode` does not map to a supported task type, `clsMyTaskCollection.AfterRetrieve` throws an `ApplicationException` naming the source, aborting the entire retrieve rather than skipping the row.
- Masking in `clsMyTaskCollection` only ever overwrites `WorkerName`; the underlying `IsExposure`, `isHealthIssue`, `isHostileWrkr`, and `IsWorkerConflict` flags and the rest of the task's fields remain visible to the caller regardless of access ([BR-011](../business-rules.md#br-011-restricted-claim-attributes-mask-the-worker-name-on-task-lists)).*
- `clsClaimTaskCollection` performs no access-based masking; only `clsMyTaskCollection` applies [BR-011](../business-rules.md#br-011-restricted-claim-attributes-mask-the-worker-name-on-task-lists).
- Both collections restrict to the Claims task source regardless of criteria the caller may have already populated on `TaskSourceSystem`.

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