> 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/date-time-picker/book-several-time-slots-at-once.md).

# Book several time slots at once

Let a customer pick several 30-minute slots in one Date Time Picker and create one Salesforce Event per slot with a Loop and a single Create Records.

Some new customers need more than one onboarding call: a kickoff, a data review, a training session. Instead of running the booking flow three times, the customer ticks three free slots in one Date Time Picker and the flow creates one Event for each.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FJBbFZOlAF5lqHEwgpdpc%2Fdate-time-picker-book-several-time-slots-at-once-result.png?alt=media" alt="Weekly Date Time Picker for 15 to 21 November with busy slots greyed out and three slots selected: Tuesday 10:00, Tuesday 15:00 and Thursday 14:00"><figcaption><p>With Type set to Checkbox, the user selects several free slots in one go.</p></figcaption></figure>

## Before you start

* Follow [Block out booked times from Events](/flow/tutorials/components/date-time-picker/how-to-block-out-times.md) so the picker already receives the manager's busy times in `BusyIntervals`.
* The single-slot version is [Build an appointment booking flow](/flow/tutorials/components/date-time-picker/build-an-appointment-booking-flow.md). This page changes the picker type and the end of that flow.
* Two resources for the Events: a record variable `NewEvent` (**Data Type** Record, **Object** Event) and a record collection variable `EventsToCreate` (same, with **Allow multiple values (collection)** checked).

## Steps

{% stepper %}
{% step %}

### Switch the picker to several slots

On the screen, select the Date Time Picker (API Name `SlotPicker`) and open the Component Builder. In the **Properties** tab:

* **Type**: Checkbox. Each click now adds or removes a slot.
* **Label**: `Pick one slot per onboarding call`.
* Keep **Variant** Weekly, **Time Slot Duration** `00:30` and **Disabled Intervals** mapped to `{!BusyIntervals}`.

**Display Next Button** is not available with Checkbox. The customer moves on with the screen's standard Next button, so keep the footer visible.
{% endstep %}

{% step %}

### Loop over the selected slots

After the screen, add a **Loop** element named `Loop_Slots` over `{!SlotPicker.valueCollection}`. **Value Collection** is the picker output that holds every selected slot as a Date/Time collection.
{% endstep %}

{% step %}

### Build one Event per slot

Inside the loop, add an **Assignment** element:

| Variable                        | Operator | Value             |
| ------------------------------- | -------- | ----------------- |
| `{!NewEvent.Subject}`           | Equals   | `Onboarding call` |
| `{!NewEvent.StartDateTime}`     | Equals   | `{!Loop_Slots}`   |
| `{!NewEvent.DurationInMinutes}` | Equals   | `30`              |
| `{!NewEvent.WhoId}`             | Equals   | `{!recordId}`     |
| `{!NewEvent.OwnerId}`           | Equals   | `{!$User.Id}`     |
| `{!EventsToCreate}`             | Add      | `{!NewEvent}`     |

`{!Loop_Slots}` is the current slot, one Date/Time per pass.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FMUXEsZlPuhWVGPb6Lj8z%2Fdate-time-picker-book-several-time-slots-at-once-assignment.png?alt=media" alt="Build Event assignment setting the new Event&#x27;s Subject, Start Date Time from the current loop item, Duration 30, Name ID, Assigned To ID, then adding it to EventsToCreate" width="320"><figcaption><p>Inside the loop, each selected slot becomes one Event added to the EventsToCreate collection.</p></figcaption></figure>
{% endstep %}

{% step %}

### Create all the Events at once

On the loop's **After Last** path, add a **Create Records** element that creates multiple records from `{!EventsToCreate}`. One Create Records after the loop saves every Event in a single operation, instead of one database call per slot.
{% endstep %}

{% step %}

### Save and test

Save and run the flow in **Debug** with a Contact Id in `recordId`. Tick Tuesday 10:00, Tuesday 15:00 and Thursday 14:00, then click **Next**. Open the manager's calendar: three 30-minute `Onboarding call` Events sit at those times, each related to the Contact. Run the flow again and the three slots are disabled.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>Only one Event is created</summary>

The loop runs over **Value** instead of **Value Collection**. **Value** holds only the first selected slot. Point the Loop at `{!SlotPicker.valueCollection}`.

</details>

<details>

<summary>The customer cannot leave the screen</summary>

With **Type** Checkbox there is no picker Next button. Check that the Screen element's footer still shows the standard Next button.

</details>

<details>

<summary>No Event is created at all</summary>

Check that the Assignment ends with the `Add` row on `{!EventsToCreate}`, and that Create Records sits on the **After Last** path, not inside the loop.

</details>

## Related tutorials

* [Build an appointment booking flow](/flow/tutorials/components/date-time-picker/build-an-appointment-booking-flow.md): the one-slot version with a **Book this time** button.
* [Block out booked times from Events](/flow/tutorials/components/date-time-picker/how-to-block-out-times.md): how the busy times reach the picker.
* [Offer only working hours](/flow/tutorials/components/date-time-picker/offer-only-working-hours.md): limit the slots to the manager's working week.


---

# 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/date-time-picker/book-several-time-slots-at-once.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.
