---
title: Retrieve a policy preferred worker
summary: Operation details for Retrieve a policy preferred worker.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Affiliate
reference_type: package
operation_id: OP-006
trigger: A caller needs one preferred-worker association identified by policy, affiliate, and effective date.
---

# Retrieve a policy preferred worker

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

| Field | Value |
| --- | --- |
| **Operation ID** | OP-006 |
| **Trigger** | A caller needs one preferred-worker association identified by policy, affiliate, and effective date. |
| **Inputs** | `IDataPortalInfo`, affiliate SSN, policy number, effective date |
| **Outputs** | `clsPolicyPreferredWorker` |
| **Primary components** | `clsPolicyPreferredWorker.GetPolicyPreferredWorker` |
| **Entry point** | `Business\SAIF.Business.Policy.Affiliate\clsPolicyPreferredWorker.vb` |

## Steps

1. Create the preferred-worker criteria from the composite key and delegate retrieval to the BOF retrieve lifecycle.
2. In `BeforeRetrieve`, assign [SQL-006](../sql/SQL-006-saif-business-policy-affiliate.md) and bind the key parameters for [BUSINESS_AFFILIATE](../database-tables.md#business_affiliate) and [AFFILIATE](../database-tables.md#affiliate).
3. The SQL filters to affiliate type `2` and joins the association row to the affiliate person row by SSN ([BR-AFF-004](../business-rules.md#br-aff-004-affiliate-associations-join-to-people-by-ssn), [BR-AFF-009](../business-rules.md#br-aff-009-preferred-worker-queries-require-type-code-2)).
4. If a row is returned, load the shared association and nested affiliate fields; otherwise leave the object at its default state ([BR-AFF-001](../business-rules.md#br-aff-001-missing-key-retrieval-returns-a-default-object)).
5. Return the preferred-worker object; eligibility details remain unloaded until a lazy property requires them.

## Process flow
The following diagram shows the type-2 filtered, SSN-joined retrieval; eligibility fields remain unloaded until requested separately.

```mermaid
flowchart TD
  Start(["Caller supplies policy, affiliate, effective date"]) --> Criteria["Build composite-key Criteria"]
  Criteria --> Before["BeforeRetrieve: assign SQL-006<br>bind key against BUSINESS_AFFILIATE + AFFILIATE"]
  Before --> Filter["SQL filters AFFILIATE_TYPE_CODE = 2<br>joins association to person by SSN"]
  Filter --> Query{"Row returned?"}
  Query -->|Yes| Load["Load shared association<br>and nested affiliate fields"]
  Query -->|No| Default["Leave object at default state"]
  Load --> Result(["Return clsPolicyPreferredWorker;<br>eligibility fields unloaded"])
  Default --> Result
```

## Failure and edge-case behavior

- Eligibility fields are loaded separately and only on demand.

## 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\clsPolicyPreferredWorker.vb`
