---
title: Coverage B task management
summary: Retrieves, creates, validates, and saves Coverage B tasks, including a due-date override that narrows the inherited two-year window to one year.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.Tasks.Claim
reference_type: package
operation_id: OP-TC-03
trigger: Caller retrieves clsCoverageBTaskCollection or creates a clsCoverageBTask via NewTask and calls Save
---

# Coverage B task management

Coverage B tasks are a Task-source-system variant (`TaskSourceSystem.CoverageB`) with their own claim-binding, category-description lookup, and validation rules. `clsCoverageBTask` and `clsCoverageBTaskCollection` are documented as a single operation because both are driven by the same Coverage B rule set and business object family: the collection resolves the tasks and their claim/category context, and the task object enforces Coverage B–specific validation before saving through the inherited BOF pipeline.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-TC-03 |
| **Trigger** | Caller calls `clsCoverageBTaskCollection.GetTasks(dpi, criteria)` to retrieve, or `clsCoverageBTask.NewTask(dpi, claimId[, createUser])` to create, followed by property edits and `Save()`/`SaveChild()` |
| **Inputs** | `IDataPortalInfo`; `CoverageBTaskCriteria` (claim list, filter dates) for retrieval; `ClaimID`/`ClaimNum`, `Text`, `TaskDate`, `MailID`, `CreateUser` for create/save |
| **Outputs** | Populated `clsCoverageBTaskCollection`; saved `clsCoverageBTask` row; resolved `WorkerName` and category description; broken-rule collection on validation failure |
| **Primary components** | `clsCoverageBTaskCollection.GetTasks`, `clsCoverageBTaskCollection.AddClaimNum`, `clsCoverageBTaskCollection.GetCategoryDescr`, `clsCoverageBTask.NewTask`, `clsCoverageBTask.PostFill`, `clsCoverageBTask.AddBusinessRules`, `clsCoverageBTask.OverrideRules`, `clsCoverageBTask.Save` |
| **Entry point** | `Business\SAIF.Business.Tasks.Claim\clsCoverageBTaskCollection.vb` |

## Steps

1. **Retrieve.** `clsCoverageBTaskCollection.GetTasks(dpi, criteria)` sets `criteria.DataPortalInfo`, calls `AddTaskSourceSystem(TaskSourceSystem.CoverageB)` to restrict the retrieve to Coverage B tasks, and calls `dpi.DataAccessLayer.RetrieveObject(criteria)`.

   > **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.
2. **Filter by claim number.** `CoverageBTaskCriteria.AddClaimNum(claimNum)` creates a throwaway `clsCoverageBTask` bound to claim ID `0`, sets its `ClaimNum` (which resolves `clsClaimData` and derives `ClaimID`), and adds the resolved `ClaimID` to `ClaimList` — an alternative to filtering by claim ID directly.
3. **Create.** `NewTask(dpi, claimId[, createUser])` builds a `Criteria` with the claim ID (and create user, if supplied) and calls `dpi.DataAccessLayer.CreateObject(crit)`. The constructor sets `TaskDateModifier = TaskDateModifierType.NextWorkDay`.
4. **BOF `Create()` override.** Sets `ClaimID` from the criteria and calls `GetClaimData()`, loading `clsClaimData` for the claim if not already cached.
5. **`PostFill()`** unconditionally calls `GetClaimData()` — unlike `clsClaimTask`, Coverage B tasks always resolve claim data regardless of whether the task is claim-bound at fill time.
6. **`ClaimNum` property setter.** Re-resolves `clsClaimData` for the new claim number (treating a passed-in `Nothing` as an empty string), sets `ClaimID`, and runs the `ClaimNum` rule check.
7. **`WorkerName`** is read-only and returns `m_ClaimData.WorkerName.Last`, or empty when no claim data is resolved yet.
8. **`CategoryDescr`** resolves the category description for `CategoryCode`: if the task `IsChild`, it delegates to the parent collection's `GetCategoryDescr`; otherwise it loads a `clsTaskCategoryCodeCollection` for the Coverage B source and looks up the code directly.
9. **Validation (`AddBusinessRules`).** Two rules are registered in addition to those inherited from `clsTask`:
   - `ValidClaimNum` ([BR-007](../business-rules.md#br-007-coverage-b-task-claim-numbers-must-be-valid)) — skipped when deleted; fails when `ClaimID = 0`; fails with "Claim number is not a Coverage B Claim." when the resolved claim's `CoverageCode <> "B"`.
   - `CommonBusinessRules.TextRequired` ([BR-008](../business-rules.md#br-008-coverage-b-task-text-is-required)) — enforces non-empty task text.

     > **Origin**: `CommonBusinessRules.TextRequired` is implemented in `SAIF.BOF.Business`; see [CommonBusinessRules](../../saif-business/api/SAIF.Business/commonbusinessrules.md) in the `SAIF.BOF.Business` documentation set.
10. **Due-date override (`OverrideRules`).** For the inherited `"TASK2"` due-date rule, if the task `IsDirty`, is not `Deleted`, and `TaskDate` is before today or after one year from today: `OverrideRules` replaces the rule's message with "Error: Due date must be between today and one year from today." and forces the result to `False` ([BR-012](../business-rules.md#br-012-coverage-b-task-due-dates-are-bounded-to-one-year)).

    > **Origin**: The base `"TASK2"` rule and the `OverrideRules` extension point are implemented by `clsTask` in `SAIF.Business.Tasks`. That library is documented in the previous format, so no per-operation page exists; see [Operations and processes](../../saif-business-tasks/operations-processes.md) in the `SAIF.Business.Tasks` documentation set.
11. **Save.** `Save()` and `SaveChild()` both call `ApplyEdit()` then the corresponding base method, delegating persistence to the inherited BOF task save pipeline.

    > **Origin**: Insert, update, and soft-delete persistence for the underlying `TASK` row are implemented by `clsTask` in `SAIF.Business.Tasks`. That library is documented in the previous format, so no per-operation page exists; see [Insert task](../../saif-business-tasks/operations/task-record-lifecycle.md), [Update task](../../saif-business-tasks/operations/task-record-lifecycle.md), and [Soft-delete task](../../saif-business-tasks/operations/task-record-lifecycle.md) in the `SAIF.Business.Tasks` documentation set.
12. **Copy and complete.** `CopyTo(mailID)` creates a fresh task bound to the same claim via `NewTask`, copies fields with the inherited `CopyTask`, and sets the new task's `MailID`. `MarkCompleted()` always sets the delete flag and marks the task dirty (unlike `clsClaimTask`, Coverage B tasks have no notepad-entry gate).

## Process flow

The following diagram visualizes Coverage B task retrieval, creation, validation (including the due-date override), and save.

```mermaid
flowchart TD
	Start([GetTasks or NewTask]) --> Which{Retrieve or create?}
	Which -->|Retrieve| SetSource[AddTaskSourceSystem CoverageB]
	SetSource --> RetrieveCall[RetrieveObject executes<br>inherited BOF collection query]
	RetrieveCall --> DoneRetrieve([Return collection])
	Which -->|Create| CreateTask[Create: set ClaimID,<br>GetClaimData]
	CreateTask --> PostFillStep[PostFill: GetClaimData<br>always resolved]
	PostFillStep --> Edit[Caller sets ClaimNum,<br>Text, TaskDate...]
	Edit --> Validate{ValidClaimNum,<br>TextRequired}
	Validate -->|Fails| Errors([Broken rules returned])
	Validate -->|Passes| Override{TASK2 override:<br>due date within 1 year?}
	Override -->|No| DateError([Due-date error added])
	Override -->|Yes| Save[Save / SaveChild]
	Save --> Persist[Inherited clsTask<br>insert/update/delete]
	Persist --> DoneSave([Task persisted])
```

## Failure and edge-case behavior

- `ValidClaimNum` blocks the save both when the claim is unresolved (`ClaimID = 0`) and when the resolved claim is not a Coverage B claim, but a deleted task bypasses the check entirely.
- The `OverrideRules` due-date narrowing only applies to dirty, non-deleted tasks; it does not run for tasks that are already clean or marked for deletion.
- `CategoryDescr` depends on the task's parent collection when the task `IsChild`; a standalone task always issues its own `clsTaskCategoryCodeCollection` lookup.*
- `AddClaimNum` silently does nothing when passed an empty claim number, rather than raising a validation error.

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