# Rating

<figure><img src="/files/rhsCd5IlYPdOIOaEp4X0" alt="" width="375"><figcaption></figcaption></figure>

***

## **Your First Rating in Minutes**

1. **Drag and Drop:** Locate the "Avonni Rating" component and drag it onto your page or screen.
2. **Label Clearly:** Label your rating with a simple, descriptive phrase like "Rate This Product" or "Your Satisfaction Level."
3. **Set Your Values:**
   * **Quick Start:** For a basic 1-to-5 star rating, choose "Manual".
   * **From Your Data:** To show ratings from Salesforce or use a calculation, pick one of these:
     * **Mapped:** Directly link to a single Salesforce field or variable.
     * **Advanced:** Combine multiple fields or variables (like averaging several survey responses). Use the formula builder for more complex calculations.
     * **Query:** Run a Salesforce query to find the rating (e.g., average rating from all customer reviews for a product). You can even use aggregate functions like AVG or MAX.
4. **You're Done!** Users can now click the stars to provide their feedback

## **Take Your Ratings Further**

Now that you've got the basics down, let's explore some ways to customize and enhance your ratings:

### **Visual Appeal**

* **Icon Name:** Swap out the default stars for hearts, thumbs-up, or other icons (use the `utility:favorite` format).
* **Icon Size:** Make those icons bigger or smaller to fit your design.
* **Variant:** Choose how you want the label and rating arranged on the screen.

### **Functionality**

* **Field Level Help:** Add a tip or instruction next to the rating to guide your users.
* **Selection Type:** Users can select any decimal value ("Continuous") or restrict themselves to whole numbers ("Single").
* **On Change Interactions:** Trigger exciting interactions when the rating changes! For example, show a "Thank you!" toast message, navigate to a different screen, or set off a celebratory confetti explosion! (Be sure to install the Avonni Components managed package to access these interactions.)

***

## Output Variables

The Rating exposes output variables you can reference in your flow after the screen. To use them, select the screen element in Flow Builder, then the Rating component, and pick the output variable you need.

### Selected Value

| Output variable | Type    | What it returns                                                                                                                                             |
| --------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Value**       | Integer | The numeric rating the user selected (e.g., `4` out of 5). This is automatically available after the screen — no interaction setup is needed to capture it. |

> **Example:** A customer satisfaction survey flow asks users to rate their support experience. After the screen, use **Value** in a Decision element: ratings below 3 trigger an escalation path, while 4–5 trigger a thank-you message.

***

## **Using the Rating Results**

Once users have given their ratings, you can easily use that data within your flow:

* **Store It:** Save ratings to a Salesforce record to track customer satisfaction, lead scores, etc.
* **Make Decisions:** Use the rating to determine the next steps in your flow—maybe a high rating leads to a thank-you message, while a low rating triggers a follow-up survey.

## **Example: Customer Feedback Survey with Flair**

Imagine you want to know how happy your customers are with a recent purchase. With the Avonni Rating component, you can:

1. Add it to your flow's confirmation screen.
2. Label it "Rate your experience."
3. Set up an "On Change" interaction to show a festive confetti animation when someone gives a 5-star rating.

The Avonni Rating component is your tool for creating interactive, informative, and *delightful* experiences within your Salesforce flows. Have fun experimenting with it!

<br>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avonnicomponents.com/flow/flow-components/rating.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
