---
title: Retrieve preferred workers for a policy
summary: Operation details for Retrieve preferred workers for a policy.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Affiliate
reference_type: package
operation_id: OP-008
trigger: A caller requests all preferred workers that overlap a policy date window.
---

# Retrieve preferred workers for a policy

This operation documents how `clsPolicyPreferredWorkerCollection.GetPolicyPreferredWorkers` fulfills the policy-affiliate behavior described for `SAIF.Business.Policy.Affiliate`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-008 |
| **Trigger** | A caller requests all preferred workers that overlap a policy date window. |
| **Inputs** | `IDataPortalInfo`, policy number, optional start date, optional end date |
| **Outputs** | `clsPolicyPreferredWorkerCollection` |
| **Primary components** | `clsPolicyPreferredWorkerCollection.GetPolicyPreferredWorkers` |
| **Entry point** | `Business\SAIF.Business.Policy.Affiliate\clsPolicyPreferredWorkerCollection.vb` |

## Steps

1. Build collection criteria from the policy number and requested window.
2. Assign [SQL-008](../sql/SQL-008-saif-business-policy-affiliate.md) in `BeforeRetrieve` and bind the policy and window parameters for [BUSINESS_AFFILIATE](../database-tables.md#business_affiliate) and [AFFILIATE](../database-tables.md#affiliate).
3. The query returns only type-`2` rows, applies overlap-window filtering, and sorts by affiliate name ([BR-AFF-005](../business-rules.md#br-aff-005-association-windows-use-overlap-semantics), [BR-AFF-006](../business-rules.md#br-aff-006-association-lists-sort-by-person-name), [BR-AFF-009](../business-rules.md#br-aff-009-preferred-worker-queries-require-type-code-2)).
4. Iterate the returned reader, load one `clsPolicyPreferredWorker` per row, and add it to the collection.
5. Return the populated collection.

## Process flow
The following diagram shows the type-2 overlap-window query and per-row child hydration.

```mermaid
flowchart TD
  Start(["Caller requests policy preferred workers"]) --> Criteria["Build collection Criteria for policy + window"]
  Criteria --> Before["BeforeRetrieve: assign SQL-008<br>bind policy + window against BUSINESS_AFFILIATE + AFFILIATE"]
  Before --> Query["Query returns type-2 rows,<br>overlap-window filtered, sorted by name"]
  Query --> Iterate["Iterate reader"]
  Iterate --> AddChild["Load one clsPolicyPreferredWorker per row<br>and add to collection"]
  AddChild --> More{"More rows?"}
  More -->|Yes| Iterate
  More -->|No| Result(["Return populated collection"])
```

## Failure and edge-case behavior

- The obsolete `GetPolicyPreferredWorkerCollection` overloads are wrappers that forward to the preferred `GetPolicyPreferredWorkers` methods.

## 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.Policy.Affiliate\clsPolicyPreferredWorkerCollection.vb`
