---
title: Look up a correspondence image sequence number
summary: Read the current output-log image sequence for a correspondence item.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Correspondence
reference_type: package
operation_id: OP-005
trigger: Caller invokes `clsCorrespondence.GetImageSequenceNumber`.
---

# Look up a correspondence image sequence number

Read the current output-log image sequence for a correspondence item.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-005 |
| **Trigger** | Caller invokes `clsCorrespondence.GetImageSequenceNumber`. |
| **Inputs** | Correspondence sequence number. |
| **Outputs** | The matching `OUTPUT_LOG.IMAGE_SEQ_NUM` value, if any. |
| **Primary components** | `clsCorrespondence.GetImageSequenceNumber` |
| **Entry point** | `Business\SAIF.Business.Policy.Correspondence\clsCorrespondence.vb` |

## Steps

1. Construct a `SqlHelper.ScalarQuery(Of Decimal)` outside the criteria pattern because this helper is a direct application-layer lookup ([SQL-007](../sql/SQL-007-saif-business-policy-correspondence.md)).
2. Bind `:CorrespondenceSequenceNumber` and execute the scalar `OUTPUT_LOG` query ([OUTPUT_LOG](../database-tables.md#output_log)).
3. Return the distinct image sequence number to the caller as a decimal value.

## Process flow

The following diagram summarizes the control flow for this operation.

```mermaid
flowchart TD
    Start([Lookup image id]) --> Bind[Bind sequence number] --> Query[Run scalar query] --> Return([Return image sequence])
```

## Failure and edge-case behavior

- Validation and framework state errors surface through the BOF error collection unless the called dependency throws directly.
- Database-dependent operations rely on the caller-supplied data portal context and Oracle connectivity.
- Imaging reconciliation and stored-procedure wrappers defer cross-system behavior to their external collaborators.

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