> 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/combobox/keep-combobox-selections-when-users-go-back.md).

# Keep Combobox Selections When Users Go Back

Keep what an agent picked in a Combobox when they click Previous or when a Decision sends them back to the screen, using a variable and the revisit setting.

A support agent picks the case priorities on the first screen, moves on, then clicks **Previous** to change something. Or a Decision sends them back because a required field is missing. Either way the agent expects their picks to still be there. Whether they are depends on one Flow Builder setting and on what the Combobox's **Value** is mapped to.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FVELkswq9GOi3iwdpQ4Ia%2Fcombobox-keep-combobox-selections-when-users-go-back-result-v2.png?alt=media" alt="Priority combobox showing Medium and High selected from a flow variable" width="375"><figcaption><p>The Combobox shows the picks held in its variable.</p></figcaption></figure>

## Before you start

* A Combobox with its options set up. See [Build Combobox Options](/flow/tutorials/components/combobox/build-combobox-options.md).
* The Combobox's API Name. This page uses `PriorityFilter`, a multi-select Combobox on Case priorities.

## What happens on a revisit

Flow Builder gives every screen component a revisit setting, in the component's **Advanced** section of the screen editor:

| Revisit setting                                                 | What the Combobox shows when the agent comes back                                                                                        |
| --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **Use values from when the user last visited this screen**      | The last selection. Flow restores the component's values.                                                                                |
| **Refresh inputs to incorporate changes elsewhere in the flow** | Whatever its inputs say now. The selection comes back only if **Value** (or **Value Collection**) is mapped to a variable that holds it. |

The first setting is enough when the agent only goes back and forth. Use the variable pattern below when a Decision loops back to the screen, or when a later step can change the selection, because the variable is then the one place that holds the current choice.

## Steps

{% stepper %}
{% step %}

### Create a variable for the selection

In Flow Builder, create a new resource: **Resource Type** Variable, **API Name** `varPriorities`, **Data Type** Text.

A Text variable works for single and multi-select comboboxes: **Value** holds a multi-selection as one text, separated by semicolons (`Medium;High`).
{% endstep %}

{% step %}

### Map the Combobox Value to the variable

1. Select the Combobox and open the Component Builder.
2. In the **Properties** tab, map **Value** to `{!varPriorities}`. The field then shows its label, **Var Priorities**.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FIUmJmIwwzP1q7itqG84M%2Fcombobox-keep-combobox-selections-when-users-go-back-value-panel.png?alt=media" alt="Combobox properties with Value mapped to the varPriorities variable" width="320"><figcaption><p>Value mapped to the variable that holds the selection.</p></figcaption></figure>

Prefer a Text collection variable? Map **Value Collection** instead. It appears in the **Properties** tab once **Is Multi Select** is on.
{% endstep %}

{% step %}

### Copy the selection into the variable after the screen

Add an **Assignment** right after the screen: `{!varPriorities}` Equals `{!PriorityFilter.value}`.

If a Decision loops back to the screen, the Assignment must run before the loop, so the variable holds the latest picks when the screen opens again.
{% endstep %}

{% step %}

### Choose the revisit setting

Open the screen, select the Combobox, and in its **Advanced** section choose **Refresh inputs to incorporate changes elsewhere in the flow**. The Combobox now reads `{!varPriorities}` every time the screen opens.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FbTfsptpO7nknGudRdzCg%2Fcombobox-keep-combobox-selections-when-users-go-back-revisit-setting.png?alt=media" alt="Screen editor Advanced section with Refresh inputs to incorporate changes elsewhere in the flow selected" width="320"><figcaption><p>The revisit setting, in the component's Advanced section.</p></figcaption></figure>
{% endstep %}

{% step %}

### Save and test

Run the flow in **Debug**. Pick High and Medium, click **Next**, then **Previous**: both pills are still there. If your flow loops back through a Decision, trigger the loop and check the same.
{% endstep %}
{% endstepper %}

## Which output to store

Store **Value**: it is the format the **Value** input reads back. **Value Collection Serialized** (`["Medium","High"]`) and **Value Comma Separated** (`'Medium','High'`) match no option, so mapping **Value** to either loses the selection or flags it as invalid. [Use a Combobox Selection in a Query or Flow](/flow/tutorials/components/combobox/use-a-combobox-selection-in-a-query-or-flow.md) lists what each output holds.

## Troubleshooting

<details>

<summary>After going back, the search returns too few results, or the Combobox shows "Attempt to de-reference a null object"</summary>

This affects a Query data source whose **Filters** compare a checkbox, number or date, or use the In operator. Before version 6.33, those filter values were lost on a revisit. Version 6.33 fixes it, but only once the flow is saved again: install 6.33 or later, open the flow, open the Combobox in the Component Builder, then save the flow as a new version and activate it.

</details>

<details>

<summary>The selection comes back but Selected Option is empty</summary>

With a Query data source on a large object (an account picker, say), when the picked record is not among the first 100 records the Combobox loads, **Selected Option** comes back empty on a revisit. **Value** and **Value Collection** still hold the record Id. Read the record from the Id instead: add a **Get Records** after the screen with **Id** In `{!AccountPicker.valueCollection}` (or **Id** Equals `{!AccountPicker.value}` for a single selection) and use that record in place of **Selected Option**.

</details>

## Related tutorials

* [Use a Combobox Selection in a Query or Flow](/flow/tutorials/components/combobox/use-a-combobox-selection-in-a-query-or-flow.md): what each value output holds, and where to use it.
* [Filter Data Tables with Multi-Select Comboboxes](/flow/tutorials/components/combobox/filter-data-tables-with-multi-select-comboboxes.md): the selection driving a Data Table on the same screen.
* [Implement Dependent Picklists in Comboboxes](/flow/tutorials/components/combobox/implement-dependent-picklists-in-comboboxes.md): two linked comboboxes on the same screen.


---

# 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/combobox/keep-combobox-selections-when-users-go-back.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.
