> 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/dynamic-components/tutorials/components/calendar/build-a-resource-timeline.md).

# Build a Resource Timeline from Salesforce Records

Build an Avonni Calendar timeline that groups Salesforce training bookings by customer account so coordinators can see each customer's schedule.

Give your training coordinator a schedule that shows which sessions are booked for each customer. Avonni Calendar reads Salesforce Event records and displays them on a timeline with one row per related account.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FAHIfmd2h2W49yehwPMiG%2Fcalendar-build-a-resource-timeline-result.png?alt=media" alt="Training timeline with two bookings for Northstar Labs and one for Harbor Works."><figcaption><p>The timeline groups bookings by their related customer account.</p></figcaption></figure>

## Before you start

* Open a Dynamic Component in Component Builder. Use a test org where your test users can read the Event and Account records and fields in this guide.
* Use two test accounts named Northstar Labs and Harbor Works. Create three timed Salesforce Events on the same future weekday. Use the times below in the time zone of the user who will test the calendar.
* Set each Event's **Related To** field to the named account. Salesforce uses that relationship to populate the Event's `AccountId`.

| Subject         | Related To     | Time           | Location   |
| --------------- | -------------- | -------------- | ---------- |
| Safety Briefing | Northstar Labs | 09:00 to 10:00 | Cedar Room |
| Safety Drill    | Harbor Works   | 11:00 to 12:00 | Maple Room |
| Equipment Setup | Northstar Labs | 13:00 to 14:00 | Cedar Room |

## Steps

{% stepper %}
{% step %}

### Connect the Calendar to Event records

Add an Avonni Calendar to the canvas and select it. In **Properties**, choose **Query** as the data source.

Create a [query](https://docs.avonnicomponents.com/dynamic-components/component-builder/data-sources/query.md) on `Event`. Restrict the query to Events with `AccountId` equal to either of the two test account IDs. Save the query and select it as the Calendar data source.
{% endstep %}

{% step %}

### Map bookings to account rows

Under **Data Mappings**, select these Event fields.

| Calendar setting  | Salesforce field |
| ----------------- | ---------------- |
| **Title**         | `Subject`        |
| **From**          | `StartDateTime`  |
| **To**            | `EndDateTime`    |
| **Resource Name** | `AccountId`      |

In the advanced mappings, keep the Event **Key Field** set to `Id`. Expand **Resource**, choose the Account's `Name` for **Label**, and keep the Account's `Id` for its **Key Field**. The label names the row. The two keys identify different records, the Event and its Account.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FkSqNLH5AKZei1w4m7qtx%2Fcalendar-build-a-resource-timeline-mappings.png?alt=media" alt="Calendar mappings for Event subject, dates and related Account." width="640"><figcaption><p>The resource mapping uses the Event's Account ID and displays the Account name.</p></figcaption></figure>
{% endstep %}

{% step %}

### Open on the booking day

In **Content**, set **Selected Display** to **Timeline** and **Selected Time Span** to **Day**. Set **Start Date** to the day of your sample bookings.
{% endstep %}

{% step %}

### Save and test

Save the Dynamic Component and open the test page as a user with access to both accounts and all three events. Find the Northstar Labs and Harbor Works rows. If the Calendar lists other resources, open **Resource** and select those two accounts. Check that Northstar Labs has Safety Briefing and Equipment Setup, and Harbor Works has Safety Drill. Compare each block's start and end with the corresponding Salesforce Event.

Navigate to an adjacent day with no test bookings. The three sample events should disappear. Return to the original day and check that they reappear. The query scopes the event records. The Calendar can list other resources separately from the bookings in view.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>An event appears under Empty or the row label is wrong</summary>

Open the Salesforce Event and check **Related To**. The example needs the account relationship so Salesforce can populate `AccountId`. In Calendar, verify that **Resource Name** points to that ID field. Expand **Resource** and check that **Label** is mapped to Account `Name`.

</details>

<details>

<summary>A teammate sees fewer bookings</summary>

Compare what the teammate can read in Salesforce with the Calendar results. The query uses the viewer's Salesforce permissions, including sharing and field access. Check the date in the Calendar toolbar and confirm that the missing record matches the query filter.

</details>

## Related tutorials

* [Filter and Search Bookings](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/calendar/filter-and-search-bookings.md) to narrow the timeline by room or subject.
* [Show Booking Details on Hover](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/calendar/show-booking-details-on-hover.md) to reveal the room without opening the Event record.
* [Calendar reference](https://docs.avonnicomponents.com/dynamic-components/components/calendar.md) for more display and data mapping options.


---

# 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/dynamic-components/tutorials/components/calendar/build-a-resource-timeline.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.
