---
title: Look up the agent of record for a policy
summary: Resolve a policy's agent-of-record key with a scalar SQL query.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Agency
reference_type: package
operation_id: OP-010
trigger: A caller invokes the direct producer helper for a policy number.
---

# Look up the agent of record for a policy

This operation bypasses the normal BOF criteria classes and performs a direct scalar lookup to read the producer key stored on a policy row.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-010 |
| **Trigger** | A caller invokes `clsProducer.GetAgent(inDataportal, inPolicyNum)`. |
| **Inputs** | `IDataPortalInfo`, `PolicyNum` |
| **Outputs** | Decimal agent number |
| **Primary components** | `clsProducer.GetAgent`, `RETRIEVE_OR_AGENT_SQL`, data-portal request helpers |
| **Entry point** | `Business\SAIF.Business.Policy.Agency\clsProducer.vb` |

## Steps
1. Build a portal request directly from the supplied data portal context instead of instantiating a BOF business-object criteria class.
2. Configure the request as a scalar text query using [SQL-008](../sql/SQL-008-retrieve-agent-of-record-for-a-policy.md) against [POLICY](../database-tables.md#policy).
3. Bind `:PolicyNum` and execute the request through the data portal.
4. Parse the scalar result into a decimal and return it to the caller ([BR-017](../business-rules.md#br-017-agent-of-record-is-read-from-policyagent_num)).

## Process flow

The following diagram visualizes the direct scalar lookup.

```mermaid
flowchart TD
  Start([GetAgent]) --> Request[Build scalar portal request]
  Request --> SQL[Assign SQL-008]
  SQL --> Query[Query POLICY]
  Query --> Parse[Parse AGENT_NUM]
  Parse --> End([Agent number returned])
```

## Failure and edge-case behavior
- The operation runs outside the normal BOF business-object retrieve lifecycle.
- The method depends on the scalar result being parseable as a decimal agent number.

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