---
title: Retrieve an affiliate by SSN
summary: Operation details for Retrieve an affiliate by SSN.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Affiliate
reference_type: package
operation_id: OP-001
trigger: A caller supplies an affiliate SSN and needs the standalone person record.
---

# Retrieve an affiliate by SSN

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

| Field | Value |
| --- | --- |
| **Operation ID** | OP-001 |
| **Trigger** | A caller supplies an affiliate SSN and needs the standalone person record. |
| **Inputs** | `IDataPortalInfo`, affiliate SSN |
| **Outputs** | `clsAffiliate` |
| **Primary components** | `clsAffiliate.GetAffiliate` |
| **Entry point** | `Business\SAIF.Business.Policy.Affiliate\clsAffiliate.vb` |

## Steps

1. Construct a `Criteria` instance from the caller-provided portal context and affiliate SSN, then delegate retrieval to the BOF data-access layer ([BR-AFF-018](../business-rules.md#br-aff-018-the-library-exposes-retrieve-only-data-access)).
2. In `BeforeRetrieve`, assign [SQL-001](../sql/SQL-001-saif-business-policy-affiliate.md) and bind the `:AffiliateID` parameter against [AFFILIATE](../database-tables.md#affiliate).
3. After execution, read the first returned row if present and map the person columns into the object; if no row is present, leave the object at default values ([BR-AFF-001](../business-rules.md#br-aff-001-missing-key-retrieval-returns-a-default-object)).
4. Mark the object old and return the retrieved affiliate to the caller.

## Process flow
The following diagram shows the retrieve-by-SSN lookup and the default-object fallback when no row matches.

```mermaid
flowchart TD
  Start(["Caller supplies affiliate SSN"]) --> Criteria["Build Criteria with portal context and SSN"]
  Criteria --> Before["BeforeRetrieve: assign SQL-001<br>bind :AffiliateID against AFFILIATE"]
  Before --> Query{"Row returned?"}
  Query -->|Yes| Map["Map person columns into clsAffiliate"]
  Query -->|No| Default["Leave object at default values"]
  Map --> MarkOld["Mark object old"]
  Default --> MarkOld
  MarkOld --> Result(["Return clsAffiliate to caller"])
```

## Failure and edge-case behavior

- Missing rows do not raise an exception; callers must treat an empty key or empty data as a not-found condition.

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