# Overview

A Resource is a reusable value you define once and use throughout your Dynamic Component. Resources, power filters, formulas, interactions, conditional visibility, and the values that flow between your component, Flows, and Agentforce.

This page helps you pick the right type and explains how Resources relate to Data Sources.

***

## Resource vs. Data Source

Avonni has two different concepts that both deal with data. They answer different questions.

| Concept         | Answers the question                                            | Example                                      |
| --------------- | --------------------------------------------------------------- | -------------------------------------------- |
| **Resource**    | *What values should my filters, formulas, or interactions use?* | A Variable holding the current user's region |
| **Data Source** | *What records should this component display?*                   | A Data Table showing open Opportunities      |

Resources feed **logic**. Data Sources feed **components**.

{% hint style="info" %}

#### Rule of thumb

If you're building a filter, a formula, an interaction, or a visibility condition, you want a Resource. If you're feeding records into a data-aware component, you want a Data Source
{% endhint %}

***

## The Three Resource Types

| Type                                                                        | What It Holds                                            | Value Can Change?                                       | Best For                                                                                    |
| --------------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| [**Constant**](/dynamic-components/component-builder/resources/constant.md) | A single fixed value                                     | No — set once, never changes                            | Default country codes, max record limits, status codes, record type IDs                     |
| [**Formula**](/dynamic-components/component-builder/resources/formula.md)   | A computed value derived from other Resources and fields | Recomputed automatically when its inputs change         | Full name from first + last, totals, conditional labels, formatted strings                  |
| [**Variable**](/dynamic-components/component-builder/resources/variable.md) | Any value — text, number, boolean, date, record, or JSON | Yes — read and written during the component's lifecycle | Filters, toggles, form state, records, Flow outputs, Agentforce responses, JSON collections |

***

## Choosing the Right Resource

Walk through these questions in order:

1. **Does the value never change, ever?** → use **Constant**.
2. **Is the value computed from other values or Salesforce fields?** → use **Formula**.
3. **Does the value need to be read, updated, or written to during the component's lifecycle?** → use **Variable**.
4. **Do you need to store structured data, a collection, or a Flow output?** → use a **Variable** with the **JSON** data type.

{% hint style="info" %}

#### **Variables are the most flexible Resource type**

With the JSON data type, a Variable can hold an entire record, a collection of records, or any nested structure — making it the bridge between Flows, Agentforce, Assignment Interactions, and your components
{% endhint %}

***

## A Note on Query and Nested Queries

You may notice that **Query** and **Nested Queries** are not listed in this Resources panel. That's deliberate.

In the Avonni app, Queries and Nested Queries are configured as **Data Sources** — directly on data-aware components — because that's where they're most useful. Under the hood they work like Resources, but exposing them in the component's Data Source section keeps the configuration close to the thing that displays the records.

| What you want to do                                             | Where to configure it |
| --------------------------------------------------------------- | --------------------- |
| **Fetch records to feed a Data Table, List, Kanban, Map, etc.** | Data Sources          |
| **Pull parent-child or multi-object records in one structure**  | Data Sources          |

See the [**Data Sources Overview**](/dynamic-components/component-builder/data-sources/overview.md) for the full picture.

***

### Where to Create a Resource

All Resources are managed in the **Resources panel** inside the Component Builder.

1. Open the Component Builder for your Dynamic Component.
2. Click the **Resources** button to open the Resources panel.
3. Click **New Resource** (usually a **+** icon).
4. Choose the type: **Constant**, **Formula**, or **Variable**.
5. Configure the resource — API name, data type, default value, and any type-specific settings.
6. Click **Save**.

***

### Referencing a Resource

Once a Resource exists, you can use it anywhere a dynamic value is accepted — filter values, component defaults, formula expressions, interaction inputs, visibility conditions, and more.

1. Open the property where you want the value.
2. Click the resource selection icon next to the field.
3. Pick the Resource from the list.

The reference is inserted automatically, wrapped in curly braces:

* `{!DEFAULT_COUNTRY_CODE}` — reference a Constant
* `{!currentUserRegion}` — reference a Variable
* `{!selectedRecord.Account.Name}` — drill into a JSON Variable's nested path
* `{{Record.email}}` — reference a Variable inside a loop (for example, a Repeater bound to a JSON Collection)


---

# 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/dynamic-components/component-builder/resources/overview.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.
