---
title: Retrieve agency contracts
summary: Load one agency contract or a contract collection.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Agency
reference_type: package
operation_id: OP-006
trigger: A caller requests one agency contract or all contracts for an agency.
---

# Retrieve agency contracts

This operation executes either the single-contract retrieve path or the collection retrieve path over `AGENCY_CONTRACT`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-006 |
| **Trigger** | A caller invokes `clsAgencyContract.GetAgencyContract` or `clsAgencyContractCollection.GetAgencyContractCollection`. |
| **Inputs** | `IDataPortalInfo`, contract sequence number and/or agency sequence number |
| **Outputs** | `clsAgencyContract` or `clsAgencyContractCollection` |
| **Primary components** | `clsAgencyContract`, `clsAgencyContractCollection`, nested `Criteria` classes |
| **Entry point** | `Business\SAIF.Business.Policy.Agency\clsAgencyContract.vb`, `Business\SAIF.Business.Policy.Agency\clsAgencyContractCollection.vb` |

## Steps
1. Build either a single-object criteria with `AgencyContractSeqNum` or a collection criteria with an optional `AgencySeqNum` scope.
2. Pass the criteria to the BOF data portal so the retrieve lifecycle executes on behalf of the target object ([BR-024](../business-rules.md#br-024-the-library-is-retrieve-only)).
3. For single-object retrieval, assign [SQL-003](../sql/SQL-003-retrieve-agency-contract-by-sequence-number.md) and bind `:AgencyContractSeqNum` against [AGENCY_CONTRACT](../database-tables.md#agency_contract) ([BR-025](../business-rules.md#br-025-identity-keys-are-agency-seq-contract-seq-and-agent-number)).
4. For collection retrieval, assign [SQL-004](../sql/SQL-004-retrieve-agency-contracts.md) and bind `:AgencySeqNum` only when the collection is scoped to one agency ([BR-010](../business-rules.md#br-010-agency-contract-collection-scope-depends-on-agency-sequence-number)).
5. Hydrate one contract or many contracts from the returned reader; missing keyed rows remain default-initialized ([BR-001](../business-rules.md#br-001-missing-key-retrieval-returns-a-default-object)).
6. Expose the loaded contracts for later classification and producer-commission checks ([BR-011](../business-rules.md#br-011-agency-contract-and-commission-codes-map-to-fixed-domain-values), [BR-013](../business-rules.md#br-013-producer-commission-contracts-require-gl-code-agt)).

## Process flow

The following diagram visualizes the two contract retrieve paths.

```mermaid
flowchart TD
  Start([Contract request]) --> Type{Single or collection?}
  Type -->|Single| One[Run SQL-003]
  Type -->|Collection| Many[Run SQL-004]
  One --> FillOne[Fill clsAgencyContract]
  Many --> FillMany[Load clsAgencyContractCollection]
  FillOne --> End([Contracts returned])
  FillMany --> End
```

## Failure and edge-case behavior
- The collection path returns all contracts when no agency scope is supplied.
- Missing keyed rows return a default-initialized contract object.

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Database tables](../database-tables.md)
- [SQL catalog](../sql/index.md)
- [API reference](../api/index.md)

## Sources
- `Business\SAIF.Business.Policy.Agency\clsAgencyContract.vb`
- `Business\SAIF.Business.Policy.Agency\clsAgencyContractCollection.vb`
