---
title: Build policy dropdown
summary: Builds the ordered select list of associated policies for the policy header.
status: draft
owner: SAIF IT Core Services
last_reviewed: 2026-10-12
library: BolMiddleware
reference_type: package
operation_id: OP-13
trigger: BolPolicyHeader view rendering
---

# Build policy dropdown

When the policy dropdown is shown, the `BolPolicyHeader` view calls `GetPolicyAssociationDropdown` to produce the select list from the header associations.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-13 |
| **Trigger** | `BolPolicyHeader` view rendering |
| **Inputs** | `PolicyHeader` with associations |
| **Outputs** | `SelectList` of policy numbers and labels |
| **Primary components** | `HeaderExtensions.GetPolicyAssociationDropdown` |
| **Entry point** | `src/BolMiddleware/Extensions/HeaderExtensions.cs` |

## Steps

1. Validate that the helper and header arguments are not null.
2. Flatten the policies from every association into one list.
3. Order the list by policy number descending ([BR-BOLMIDDLEWARE-015](../business-rules.md#br-bolmiddleware-015-policy-dropdown-ordering)).
4. Move the policy that equals the header policy number to the first position.
5. Add each policy to a dictionary keyed by policy number with the label `<number> - <name>`.
   - If a policy number appears twice: `Dictionary.Add` throws an `ArgumentException` and the view fails.
6. Return a `SelectList` over the dictionary. The view shows it only when the dropdown is allowed ([BR-BOLMIDDLEWARE-012](../business-rules.md#br-bolmiddleware-012-policy-dropdown-visibility)).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Render dropdown]) --> S1[Flatten associations]
	S1 --> S2[Order by policy number descending]
	S2 --> S3[Move current policy first]
	S3 --> D1{Duplicate policy number?}
	D1 -->|Yes| EndErr([ArgumentException])
	D1 -->|No| EndOk([Return SelectList])
```

## Failure and edge-case behavior

- Duplicate policy numbers across associations break rendering of the whole header.

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Architecture](../architecture.md)
- [Dependencies](../dependencies.md)
- [Configuration](../configuration.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Security and authorization](../security-authorization.md)
- [Service registration](../service-registration.md)
- [API reference](../api/index.md)

## Sources
- src/BolMiddleware/Extensions/HeaderExtensions.cs
- src/BolMiddleware/Pages/Components/BolPolicyHeader/default.cshtml
