> 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/list/search-filter-and-paginate.md).

# Search, Filter and Paginate a List

Keep a long List usable on a flow screen: pages or scrolling, a search bar, filter menus and sort options, so users reach the right record fast.

The pipeline list from the forecast call started with twenty deals. Now it holds two hundred, and the sales manager wants to type "Atlas" and find the deal, see only the deals in Negotiation/Review, and sort them by amount. This page adds a search bar, filters and sort options, and sets how the long list loads.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FKFRsdheN39j8rL2oYDfU%2Flist-search-sort.png?alt=media" alt="A deal list with a search box, the item count, Sorted by Close Date and the sort menu open on Amount and Close Date" width="480"><figcaption><p>The sort menu offers each sortable field in both directions</p></figcaption></figure>

## Before you start

* A List on a flow screen fed by a **Get Records** collection. [Show Dates, Times and Links](https://docs.avonnicomponents.com/flow/tutorials/components/list/show-dates-times-and-links.md) builds the one used here: `Get_Open_Deals` (open Opportunities) shown in `PipelineList`.
* Every setting below lives in the **Properties** tab of the Component Builder. The [List](https://docs.avonnicomponents.com/flow/flow-components/list.md) reference lists their defaults.

## Steps

{% stepper %}
{% step %}

### Choose how a long list loads

| You want                      | Set                                                                                                   | What users see                                                           |
| ----------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| Pages                         | **Show Pagination** on, in the **Pagination** group                                                   | Page buttons under the list                                              |
| A fixed-size box that scrolls | **Height** in the **Style** tab, **Size** section (for example `400px`), with **Show Pagination** off | The list scrolls inside the box and loads the next batch near the bottom |
| Neither                       | Nothing                                                                                               | A **Show More** button once the list holds more items than one batch     |

**Number of Items per Page** sets the size of a page, or of each batch when the list scrolls or shows **Show More**. It accepts 1 to 200 and defaults to 100.

Here is the fixed-size box: a **Height** set, **Show Pagination** off, and the list scrolling inside it.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2F77KILIaf1rbHW4sfx3qP%2Flist-search-filter-and-paginate-scroll.png?alt=media" alt="A deal list inside a fixed-height box, scrolled part way down, with rows cut off at the top and bottom edges" width="320"><figcaption><p>With a height set and pagination off, the list scrolls inside its box</p></figcaption></figure>

For the pipeline, turn on **Show Pagination** and set **Number of Items per Page** to `5`.
{% endstep %}

{% step %}

### Add a search bar

1. In the **Search** group, turn on **Show Search**.
2. Set **Placeholder** to `Search deals`. **Position** places the bar: **Left**, **Right**, **Center**, **Fill**, or **Panel** (inside the side panel).
3. The search already looks in the **Label** and **Description** fields, so `Atlas` finds the deal by its name. To search another field, add it to **Search Fields** in **Data Mappings**, for example **Type**.

**Search Fields** alone does not show the bar: **Show Search** has to be on.
{% endstep %}

{% step %}

### Add filters

1. In **Data Mappings**, add **Stage** and **Close Date** to **Filters**.
2. In the **Filter** group, keep **Type** on **Horizontal**: one menu per field above the list. The [List](https://docs.avonnicomponents.com/flow/flow-components/list.md) reference compares it with **Popover** and **Panel**, and the **Side panel** settings.
3. Turn on **Use Record Picklist Values**, so the **Stage** filter offers only the stages present in the deals.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2F6IApRoW3HXvUoCGv3dGM%2Flist-filter-horizontal.png?alt=media" alt="Stage and Close Date filter buttons above a list, the Stage menu open" width="480"><figcaption><p>Horizontal: the filters sit in a row above the list, and the menu offers only the stages present in the list</p></figcaption></figure>
{% endstep %}

{% step %}

### Let users sort

1. In **Data Mappings**, add **Amount** and **Close Date** to **Sortable Fields**. Users pick one of them to reorder the list.
2. Set **Sort By** to **Close Date**: the list opens sorted on it.
3. In the **Sort** group, set **Sorted Direction** to **Ascending order**, and turn on **Show Sorted By Value** so the list shows which field it is sorted on.

The **Sortable** toggle in the same group is a different feature: it lets users drag items into a new order. See [How to Reorder Items and Update Records](https://docs.avonnicomponents.com/flow/tutorials/components/list/how-to-reorder-items-and-update-records.md).
{% endstep %}

{% step %}

### Show the number of items

Turn on **Show Number of Items** (top of the **Properties** tab) so users know how many deals match their search and filters.
{% endstep %}

{% step %}

### Save and test

1. Save the flow and click **Debug**.
2. The list shows five deals and page buttons.
3. Type `Atlas` in the search bar: only the Atlas deals remain.
4. Pick **Negotiation/Review** in the **Stage** filter, then sort by **Amount**.
   {% endstep %}
   {% endstepper %}

{% hint style="info" %}
**Two hundred records or two hundred thousand?** A **Get Records** element loads every record into the flow before the screen opens. With a **Query** data source instead, the List fetches one page or batch at a time, and the search and filters become part of its query. [Query vs Variable](https://docs.avonnicomponents.com/flow/component-builder/data-sources/query-vs-variable.md) compares the two.
{% endhint %}

## Troubleshooting

<details>

<summary>There is no search bar</summary>

**Show Search** is off. Adding fields to **Search Fields** is not enough on its own.

</details>

<details>

<summary>The search misses a value that is on the item</summary>

The field holding it is not the **Label**, the **Description** or one of the **Search Fields**. The **Search Fields** picker only offers fields Salesforce can filter on, so a long text area such as an Opportunity Description cannot be searched.

</details>

<details>

<summary>The list never loads more when users scroll</summary>

Scrolling loads more only when a **Height** is set in **Style** > **Size** and **Show Pagination** is off. With pagination on, users get page buttons instead.

</details>

<details>

<summary>Sort By and Sorted Direction are missing</summary>

The **Data Source** is **Query**. The opening order then comes from the query's own order setting. **Sortable Fields** is still there for users.

</details>

<details>

<summary>The last page button is missing</summary>

With a **Query** data source, the last page button is always hidden. Users move through the pages with the other buttons.

</details>

## Related tutorials

* [Show Dates, Times and Links](https://docs.avonnicomponents.com/flow/tutorials/components/list/show-dates-times-and-links.md): builds the pipeline list used on this page.
* [Act on a Row](https://docs.avonnicomponents.com/flow/tutorials/components/list/act-on-a-row.md): once users find the deal, let them act on it.
* [Build a Checklist That Saves](https://docs.avonnicomponents.com/flow/tutorials/components/list/build-a-checklist-that-saves.md): the same search and pages work on a checklist.


---

# 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/list/search-filter-and-paginate.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.
