> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/tutorials/components/navigation/reuse-one-menu-across-a-multi-screen-flow.md).

# Reuse One Menu Across a Multi-Screen Flow

Define a menu once with the New Navigation Item Collection action, show it on every screen, and route the agent to the screen they pick with a Decision.

Some flows outgrow one screen. A service agent working an account moves between an overview, a contacts screen, an opportunities screen and a cases screen, each with its own components and its own validation. A side menu on every screen lets the agent jump to any of them in one click, in any order. You define the menu once, and a Decision sends the agent where they clicked.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fb6Wr10EbjKtrkMg575n0%2Freuse-one-menu-across-a-multi-screen-flow-result.png?alt=media" alt="A side menu with Overview active next to the account overview"><figcaption><p>The same side menu sits on every screen of the flow.</p></figcaption></figure>

## Before you start

* A screen flow that receives the account Id, for example a text input variable `recordId`.
* The [New Navigation Item Collection](https://docs.avonnicomponents.com/flow/actions/ui-and-navigation/new-navigation-item-collection.md) action page, for the fields each item accepts, and the [Navigation](https://docs.avonnicomponents.com/flow/flow-components/navigation.md) reference for the component settings.
* If the four views fit on one screen, [tabs on one screen](https://docs.avonnicomponents.com/flow/tutorials/components/navigation/build-tabs-on-one-screen-with-navigation.md) are simpler. Use this pattern when each view needs its own screen.

## How the flow is shaped

The flow runs in a loop: build the menu once, then a Decision picks the screen, the agent clicks a menu item, an Assignment stores the item, and the flow goes back to the Decision. In the figure, a **Get Records** on the account also runs before the Decision, for the fields the screens display.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FPLFNsNyic637SkHqUveP%2Freuse-one-menu-across-a-multi-screen-flow-canvas.png?alt=media" alt="Flow canvas with Build Menu, Get Account, a Route decision, four screens and assignments looping back to Route"><figcaption><p>Build the menu once, route, store the click, loop back.</p></figcaption></figure>

## Steps

{% stepper %}
{% step %}

### Build the menu once with the action

1. At the start of the flow, add an **Action** element and pick **New Navigation Item Collection** (category **Avonni**). Name it `Build_Menu`.
2. Under **Navigation Items**, add four items with these **Label** and **Value** pairs: Overview `overview`, Contacts `contacts`, Opportunities `opportunities`, Cases `cases`.

Flow Builder stores the action's output, a collection of navigation items, under the action's name. Every screen will read the same `Build_Menu` output, so a new item added here appears on all screens at once.
{% endstep %}

{% step %}

### Create the variable that remembers the current item

Create a **Text** variable named `activeItem` with the default value `overview`. It holds the item the agent picked last, and it decides which screen comes next.
{% endstep %}

{% step %}

### Add the router Decision

Add a **Decision** element after the action, named `Route`. Create one outcome per item, in menu order:

* Outcome **Overview**: `{!activeItem}` **Equals** `overview`
* Outcome **Contacts**: `{!activeItem}` **Equals** `contacts`
* and so on for `opportunities` and `cases`.

Point the default outcome to the Overview screen too, so an unexpected value never strands the agent.
{% endstep %}

{% step %}

### Add the Navigation to each screen

On each outcome, add a **Screen** element with an **Avonni Navigation** on it, then your own components for that view. In the Component Builder of each Navigation:

1. Set **Orientation** to **Vertical** for a side menu.
2. Choose the **Variable** data source. Under **Items Collection**, choose **Custom** and type `Build_Menu`, the action's API name (the dropdown does not list action outputs).
3. Set **Active Navigation Item Value** to `{!activeItem}`, so the menu highlights the screen the agent is on.
   {% endstep %}

{% step %}

### Leave the screen when an item is clicked

On each Navigation, open the **Interactions** tab and add a **Select** interaction:

1. Leave **Target Name** empty. An empty target fires for every item, which is what a menu needs.
2. Set **Type** to **Flow Navigation**. A second **Type** field appears: set it to **Next Screen**.

The Navigation sets **Active Navigation Item Value** to the clicked item before it moves the flow on, so the value is ready on the next element. See [Flow Navigation](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/flow-navigation.md) for the other navigation types.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FdwRffmZvsuS4IfaWUCUD%2Freuse-one-menu-across-a-multi-screen-flow-interaction.png?alt=media" alt="Select interaction set to Flow Navigation, Next Screen, with no target name"><figcaption><p>An empty Target Name makes every menu item move the flow on.</p></figcaption></figure>
{% endstep %}

{% step %}

### Store the clicked item and loop back

After each screen, add an **Assignment**: `{!activeItem}` **Equals** that screen's Navigation > **Active Navigation Item Value** (for example `{!ContactsMenu.activeNavigationItemValue}`). Connect the Assignment back to the `Route` Decision.

Each screen needs its own Assignment, because each Navigation has its own API name. Connect back to the Decision, not to the action: the menu is already built.
{% endstep %}

{% step %}

### Save and test

Save and click **Debug**. The flow opens on Overview with Overview highlighted in the side menu. Click **Cases**: the flow moves to the Cases screen and the menu now highlights Cases. Click **Contacts**, then **Overview**: each click lands on the matching screen, in any order.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
To stop agents using the standard Next and Previous buttons, which would leave the loop, hide them in each screen's footer settings. The menu is then the only way to move.
{% endhint %}

## Troubleshooting

<details>

<summary>A click reloads the same screen</summary>

The Assignment after that screen reads another screen's Navigation. Check that `{!activeItem}` is assigned from the Navigation on the screen the Assignment follows.

</details>

<details>

<summary>The menu highlights the wrong item on a screen visited before</summary>

Flow can reuse the values from the agent's last visit to a screen. Select the Navigation on the screen and, in the Flow Builder properties pane (not the Component Builder), open its **Advanced** section and set **Revisited Screen Values** to refresh inputs, so **Active Navigation Item Value** reads `{!activeItem}` again.

</details>

<details>

<summary>Nothing happens on click</summary>

The **Select** interaction is missing, or its **Target Name** holds one item's value, so only that item fires. Clear **Target Name**.

</details>

## Related tutorials

* [Build tabs on one screen with Navigation](https://docs.avonnicomponents.com/flow/tutorials/components/navigation/build-tabs-on-one-screen-with-navigation.md): the same menu without leaving the screen.
* [Building a navigation menu with related records](https://docs.avonnicomponents.com/flow/tutorials/components/navigation/building-a-navigation-menu-with-related-records.md): a menu whose items are the account's records.
* [Creating navigational screen flows in router mode](https://docs.avonnicomponents.com/flow/tutorials/projects/creating-navigational-screen-flows-in-router-mode.md): the same router idea with a clickable Progress Indicator.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/tutorials/components/navigation/reuse-one-menu-across-a-multi-screen-flow.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
