---
title: Expand or collapse the applications section
summary: Toggle the applications accordion between expanded and collapsed, and persist the user's choice.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.V2.Menu
reference_type: package
operation_id: OP-MENU-006
trigger: Clicking the expand/collapse toggle icon (`SAIFMenu.ExpandClick`).
---

# Expand or collapse the applications section

Toggle the applications accordion between expanded and collapsed, and persist the user's choice. This operation is implemented by `SAIFMenu.ExpandClick`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-006 |
| **Trigger** | Clicking the expand/collapse toggle icon (`SAIFMenu.ExpandClick`). |
| **Inputs** | Current `ContextValue`; current `ShowApps` state; `Preferences` (may be `Nothing`). |
| **Outputs** | Rebuilt or removed accordion; updated `ShowApps`; persisted `SHOWAPPS` preference. |
| **Primary components** | `SAIFMenu.ExpandClick` |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb` |

## Steps

1. Save the current context value into `Session("CVTextBox" & ViewID)` and remove the accordion from the navigation panel. Enforces [BR-MENU-032](../business-rules.md#br-menu-032-the-context-value-is-preserved-before-menu-driven-postback-navigation).
2. If the toggle image currently reads "Expand", switch it to `apps-minus.gif`/"Collapse", set `ShowApps` to true, rebuild the accordion (see [Render the applications accordion](render-the-applications-accordion.md)) and re-select the category. Otherwise switch to `apps-plus.gif`/"Expand" and set `ShowApps` to false. Enforces [BR-MENU-033](../business-rules.md#br-menu-033-the-applications-section-toggles-between-expanded-and-collapsed), [BR-MENU-034](../business-rules.md#br-menu-034-expanding-the-applications-section-rebuilds-and-re-selects-the-category).
3. If preferences are available, store `SHOWAPPS` = `Y`/`N` at `PrefScope.AppLevel` and call `Save()`. Enforces [BR-MENU-035](../business-rules.md#br-menu-035-the-expandcollapse-choice-is-saved-as-a-user-preference).
   - No SQL here — `clsPreferences` in `SAIF.Presentation` persists the value through `SAIF.Framework.Preferences` to Oracle (DB user `CLM`).
4. - If `Preferences` is `Nothing` (identity not in `DOMAIN\user` form), the expand/collapse choice is applied for the current render only and is not persisted. Enforces [BR-MENU-043](../business-rules.md#br-menu-043-preference-handling-is-skipped-for-non-domainuser-identities).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["Clicking the expand/collapse toggle icon (SAIFMenu.ExpandClick)"]) --> Save["Save context value to Session and remove accordion"]
	Save --> Check{Toggle image reads Expand?}
	Check -->|Yes| Expand["Switch to apps-minus.gif / Collapse, set ShowApps=true"]
	Expand --> Rebuild["Rebuild accordion and re-select category"]
	Check -->|No| Collapse["Switch to apps-plus.gif / Expand, set ShowApps=false"]
	Rebuild --> Pref{Preferences available?}
	Collapse --> Pref
	Pref -->|Yes| SavePref["Store SHOWAPPS at PrefScope.AppLevel and Save()"]
	Pref -->|No| Transient(["Choice applied for current render only"])
	SavePref --> End(["Rebuilt or removed accordion; updated ShowApps"])
```

## Failure and edge-case behavior

- No `clsPreferences` instance available: the toggle still works for the current page, but the choice is lost on the next session ([BR-MENU-043](../business-rules.md#br-menu-043-preference-handling-is-skipped-for-non-domainuser-identities)).

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Database tables](../database-tables.md)

## Sources
- `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb`
