> 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/carousel/build-a-related-products-carousel.md).

# Build a Related Products Carousel

Load products with Get Records, show them as cards in a Carousel, and open the next screen with the product the sales rep clicked.

A sales rep building an opportunity picks add-on products from a carousel of product cards. Clicking a card takes the rep to the next screen, which already knows the chosen product. The products come from a Get Records element, so the flow can filter them any way it needs before the screen.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FupzNBYu2aNzKMHRN4jBv%2Fcarousel-build-a-related-products-carousel-result.png?alt=media" alt="Avonni Carousel showing two product cards per panel on a flow screen"><figcaption><p>Two products per panel, loaded by Get Records.</p></figcaption></figure>

## Before you start

* A screen flow in Flow Builder.
* Product2 records with `IsActive` checked, and a picture URL in the standard Display URL field (`DisplayUrl`).
* No filtering needed before the screen? [Show Records in a Carousel with a Query](https://docs.avonnicomponents.com/flow/tutorials/components/carousel/show-records-in-a-carousel-with-a-query.md) does the same without Get Records.

## Steps

{% stepper %}
{% step %}

### Get the products

1. Add a Get Records element and name it `GetProducts`.
2. Object: Product.
3. Filter the records: `IsActive` equals `True`.
4. How many records to store: all records.

Leave the record data stored automatically.
{% endstep %}

{% step %}

### Add the Carousel to a screen

1. After `GetProducts`, add a Screen element, for example `Pick a Product`.
2. In the Components panel, search for **Avonni Carousel** and drag it onto the screen.
3. Set its API name to `ProductCarousel`. The other Carousel tutorials use the same name.
4. Click **Open Component Builder**.
   {% endstep %}

{% step %}

### Connect the products

In the **Properties** tab, open **Data Source**:

1. Select **Variable**.
2. In **Items Collection**, select `GetProducts`.
   {% endstep %}

{% step %}

### Map the product fields to the card

Open **Data Mappings**:

| Card part        | Product2 field                      |
| ---------------- | ----------------------------------- |
| **Title**        | Product Name (`Name`)               |
| **Description**  | Product Description (`Description`) |
| **Image Source** | Display URL (`DisplayUrl`)          |
| **Key Field**    | `Id` (the product ID)               |

**Key Field** is required. It sits under **Advanced Options**, at the bottom of the mappings. Its value is what the Carousel returns in **Clicked Item Name** when the rep clicks a card.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FYKKcQYaY3v9ew0re2mKu%2Fcarousel-build-a-related-products-carousel-panel.png?alt=media" alt="Carousel Data Source set to Variable with GetProducts and the four product field mappings" width="320"><figcaption><p>GetProducts feeds the Carousel, and four fields fill each card.</p></figcaption></figure>
{% endstep %}

{% step %}

### Show two products at a time

Open **Layout** and set **Items per panel**, **Small Items per panel**, **Medium Items per panel** and **Large Items per panel** to `2`.

The Carousel scrolls by itself every 5 seconds. To let the rep browse at their own pace, turn on **Disable Auto Scroll**.
{% endstep %}

{% step %}

### Go to the next screen on click

1. Open the **Interactions** tab.
2. Under **Item Click**, add an interaction.
3. Set **Type** to **Flow Navigation**, then the second **Type** to **Next Screen**.

This interaction makes every card clickable, so **Items Clickable** can stay off.
{% endstep %}

{% step %}

### Use the clicked product on the next screen

1. Click **Done**, then add a second screen after `Pick a Product`.
2. Add a Display Text component and insert the Carousel output, for example `{!ProductCarousel.clickedItem.Name}` for the product name.

The Carousel exposes two outputs for the click:

| Output                | What it holds                                        |
| --------------------- | ---------------------------------------------------- |
| **Clicked Item**      | The Product2 record of the card the rep clicked      |
| **Clicked Item Name** | That card's **Key Field** value, here the product ID |

The elements after this screen can use **Clicked Item Name** as the product ID, for example to find the product's price book entry before adding it to the opportunity.
{% endstep %}

{% step %}

### Save and test

Save the flow, then click Debug or run it.

The first screen shows the active products two at a time, with a picture, a name and a description on each card. Click a card: the flow moves to the second screen, which prints the name of that product.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>The second screen shows an empty product name</summary>

The rep reached it through the footer Next button, not by clicking a card, so **Clicked Item** was never set. Hide the first screen's footer so a card click is the only way forward, or check the output with a Decision element before using it.

</details>

<details>

<summary>The cards have no picture</summary>

**Image Source** is not mapped, or the product's Display URL field is empty. Open a product and check that Display URL holds a full image address.

</details>

<details>

<summary>GetProducts does not appear in Items</summary>

The Get Records element must sit before the screen in the flow, and store all records, not only the first one.

</details>

## Related tutorials

* [Show Records in a Carousel with a Query](https://docs.avonnicomponents.com/flow/tutorials/components/carousel/show-records-in-a-carousel-with-a-query.md): the same cards without a Get Records element.
* [Add Action Buttons to Carousel Slides](https://docs.avonnicomponents.com/flow/tutorials/components/carousel/add-action-buttons-to-carousel-slides.md): offer several choices per card, such as Add or Details.
* [Show Details for the Visible Slide](https://docs.avonnicomponents.com/flow/tutorials/components/carousel/show-details-for-the-visible-slide.md): follow the card the rep is looking at instead of the one clicked.


---

# 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/carousel/build-a-related-products-carousel.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.
