> 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/actions/data-manipulation-and-transformation/sobject-collection-to-activity-timeline-items.md).

# SObject Collection to Activity Timeline Items

Turn up to 10 record collections into one list of timeline items, so the Avonni Timeline can show Tasks, Events and Cases together in a screen flow.

The **Avonni Timeline** reads one collection. When an account's history is spread across several objects (calls logged as Tasks, site visits as Events, support Cases), this action merges their record collections into a single collection of timeline items, with a title, an icon and a date for each record. The Timeline then displays it as is.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FkvH0ydfQDzGEJtWWeEyR%2Ftimeline-sobject-collection-to-activity-timeline-items-action.png?alt=media" alt="The action&#x27;s Tasks collection with its Title, Description, Icon Name and Date mappings" width="640"><figcaption><p>Each collection maps its records to timeline items.</p></figcaption></figure>

## When to use it

* The timeline must mix records from two or more objects. For a single object, map it in the Timeline itself with a **Variable** or **Query** data source: see [Display Tasks](https://docs.avonnicomponents.com/flow/tutorials/components/timeline/display-tasks.md).
* Each object needs its own icon or its own fields on the timeline.

## What you set in the action

Click **Add Collection** once per object, up to 10. Each collection has:

| Setting                          | What it does                                                                                                                  |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **Collection**                   | The record collection to convert, usually the output of a **Get Records**.                                                    |
| **Default Selection Collection** | Optional. Records of the same object that start ticked, when **Has Checkbox** is on.                                          |
| **Title**                        | The item's title. Prefilled with the Subject for Tasks and Events.                                                            |
| **Description**                  | The text under the title. Prefilled with the Description for Tasks and Events.                                                |
| **Icon Name**                    | The icon shown on the item, for example `standard:case`. Prefilled for Tasks (`standard:task`) and Events (`standard:event`). |
| **Date**                         | The date that places the item on the timeline. Prefilled with the Due Date for Tasks and the Start date for Events.           |
| **URL**                          | Optional. The address the item title links to, for example the record's page.                                                 |
| **Target**                       | Where the link opens: **Self**, **Blank** (new tab), **Parent** or **Top**.                                                   |
| **Is Active**                    | When true and the item has no icon, the bullet becomes a blue circle.                                                         |
| **Has Checkbox**                 | When true, a checkbox shows before the item's title.                                                                          |
| **Fields**                       | Extra fields shown on the item with their label, for example **Status**.                                                      |
| **Key Field**                    | Under the collection's **Advanced Options** link. The unique identifier of each item; keep the default, the record's `Id`.    |

The action returns one collection of `avcmpbuilder__ActivityTimelineItem` that holds the items of every collection.

## Use it in a flow

{% stepper %}
{% step %}

### Get the records

Add one **Get Records** per object, each storing **All records**, for example `Get_Tasks`, `Get_Events` and `Get_Cases` filtered on the current account.
{% endstep %}

{% step %}

### Add the action

Add an **Action** element, filter on the **Avonni** category and pick **SObject Collection to Activity Timeline Items**.
{% endstep %}

{% step %}

### Map each collection

Click **Add Collection**, pick a collection in **Collection** and fill its mappings. Repeat for each object.
{% endstep %}

{% step %}

### Store the output

The action stores its output on its own: **View Output Resources** lists it as `output`, ready for the Timeline. To use your own variable instead, select **Manually assign variables (advanced)**, just below, and store the output in a new variable: **Apex-Defined**, **Allow multiple values (collection)** checked, **Apex Class** `avcmpbuilder__ActivityTimelineItem`.
{% endstep %}

{% step %}

### Display it

On a screen, set the **Avonni Timeline**'s **Data Source** to **Variable** and pick that variable in **Items Collection**. The Timeline needs no **Data Mappings**: the action already shaped the items.
{% endstep %}
{% endstepper %}

The full walkthrough, with the mappings of each object and the result, is in [Assigning multiple source collections to the Timeline](https://docs.avonnicomponents.com/flow/tutorials/components/timeline/assigning-multiple-source-collection-to-the-timeline.md).

{% hint style="warning" %}
On package versions before 6.33.0, a **Horizontal** Timeline ignores the **Icon Name** set by this action and shows a grey default icon on every item, while the vertical view is right. Upgrade, or use the workaround in [Create a horizontal activity timeline](https://docs.avonnicomponents.com/flow/tutorials/components/timeline/create-a-horizontal-activity-timeline.md).
{% endhint %}

## Related pages

* [Timeline](https://docs.avonnicomponents.com/flow/flow-components/timeline.md): every setting of the component.
* [Assigning multiple source collections to the Timeline](https://docs.avonnicomponents.com/flow/tutorials/components/timeline/assigning-multiple-source-collection-to-the-timeline.md): the step-by-step tutorial.


---

# 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/actions/data-manipulation-and-transformation/sobject-collection-to-activity-timeline-items.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.
