---
title: Legal case retrieval
summary: Retrieves legal case header data (case number, attorney, status, hearing date) for a claim from the Legal API.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-30
library: SAIF.Business.View.Claim
reference_type: package
operation_id: OP-VC-13
trigger: Caller constructs `clsLegalData(dataPortalInfo, claimId, legalCaseSeqNum)`
---

# Legal case retrieval

This operation retrieves legal case header data for a claim — case number, attorney name, case status, and hearing date — from the Legal API.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-VC-13 |
| **Trigger** | Caller constructs `clsLegalData(dataPortalInfo, claimId, legalCaseSeqNum)` |
| **Inputs** | Claim ID, legal case sequence number |
| **Outputs** | `CaseNumber`, `AttorneyName`, `CaseStatus`, `HearingDate` |
| **Primary components** | `clsLegalData.New`, `clsLegalData.GetLegalHeader` |
| **Entry point** | `Business\SAIF.Business.View.Claim\clsLegalData.vb`, `Business\SAIF.Business.View.Claim\LegalApi\LegalData.vb` |

## Steps

1. **Construct the object.** `clsLegalData.New(dataPortalInfo, claimId, legalCaseSeqNum)` immediately calls `GetLegalHeader` to populate itself.
2. **Call the Legal API.** `GetLegalHeader` calls the Legal API client (`ApiClients.Item("LegalApi")`) against route `v1/info/header/{0}`.
   - On failure: if the call throws, `result` is reset to a new, empty `LegalData()` rather than propagating the exception.
3. **Copy header fields.** The constructor copies `CaseNumber`, `AttorneyName`, `CaseStatus`, and `HearingDate` from the returned `LegalData` DTO onto the object's own properties.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Caller constructs clsLegalData]) --> Call[Call Legal API header route]
	Call --> Ok{API call succeeds?}
	Ok -->|No| Empty[Use empty LegalData]
	Ok -->|Yes| Copy[Copy case number, attorney,<br>status, and hearing date]
	Empty --> Done([Return populated clsLegalData])
	Copy --> Done
```

## Failure and edge-case behavior

- A failed Legal API call is swallowed and replaced with an empty `LegalData` object, so construction always succeeds structurally even when the underlying legal case cannot be retrieved; callers cannot distinguish "no legal case" from "API call failed" without additional checks.*

## Related documentation

- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources

- `Business\SAIF.Business.View.Claim\clsLegalData.vb`
- `Business\SAIF.Business.View.Claim\LegalApi\LegalData.vb`
