> 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/build-an-appointment-booking-flow.md).

# Build an appointment booking flow

Build a Screen Flow where a new customer picks a free 30-minute slot and the flow creates the onboarding call as a Salesforce Event.

During the welcome call, an account manager opens a flow from the new customer's Contact record. The customer picks a free 30-minute slot in the week, the manager clicks **Book this time**, and the flow creates the onboarding call in her calendar. Nobody types a date by hand, and a taken slot cannot be picked.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2F2KPSwjbSaNLLfOsETj0c%2Fdate-time-picker-build-an-appointment-booking-flow-result.png?alt=media" alt="Weekly Date Time Picker for 15 to 21 November with booked slots greyed out and Tuesday 10:00 selected next to a Book this time button"><figcaption><p>The customer picks a free slot and the Book this time button appears.</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) first. This flow starts with the same Get Records, Loop and Assignment, and the same `BusyIntervals` collection.
* A Text variable `recordId`, **Available for input**, so the flow receives the Contact when it runs from the Contact record (for example through a quick action).
* The [Date Time Picker](/flow/flow-components/date-time-picker.md) reference page, for any property not covered here.

## Steps

{% stepper %}
{% step %}

### Load the busy times

Build the start of the flow as in [Block out booked times from Events](/flow/tutorials/components/date-time-picker/how-to-block-out-times.md): Get Records on Event for `{!$User.Id}`, a Loop, and an Assignment that fills `BusyIntervals`. Connect the loop's **After Last** path to a new Screen element.
{% endstep %}

{% step %}

### Set up the picker for one slot

Add the Avonni Date Time Picker to the screen, set its **API Name** to `SlotPicker`, and open the Component Builder. In the **Properties** tab:

* **Label**: `Pick a time for your onboarding call`.
* **Type**: Radio, so the customer selects one slot.
* **Variant**: Weekly, to show the whole week at once.
* **Time Slot Duration**: `00:30`.
* **Required**: on.

Under **Visible Dates and Times**, set **Start Time** `09:00`, **End Time** `17:00`, map **Disabled Intervals** to `{!BusyIntervals}`, and turn on **Show Disabled Dates**.
{% endstep %}

{% step %}

### Add the Next button

Still in the **Properties** tab:

1. Turn on **Display Next Button**. It only appears when **Type** is Radio.
2. Set **Next Button Label** to `Book this time`.

The button shows once a slot is selected.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FL42oEVrfUWUUvUtcoH15%2Fdate-time-picker-build-an-appointment-booking-flow-properties.png?alt=media" alt="Component Builder for the Date Time Picker: the weekly preview with Tuesday 10:00 selected and Book this time, and the Properties panel showing Required on, Display Next Button on and Next Button Label Book this time"><figcaption><p>Display Next Button on and Next Button Label set to Book this time. The preview shows the button next to the selected slot.</p></figcaption></figure>
{% endstep %}

{% step %}

### Make the button move the flow forward

The button needs an interaction to advance the flow. In the **Interactions** tab:

1. Add an interaction on **Next Button Click**.
2. Set its type to [Flow Navigation](/flow/component-builder/interactions-panel/flow-navigation.md) and choose **Next Screen**.

To avoid two Next buttons on the same screen, open the Screen element's **Configure Footer** section and, under **Next or Finish Button**, choose **Hide Next or Finish**.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FEZ1opu1Rqcm5iVRARdIw%2Fdate-time-picker-build-an-appointment-booking-flow-interaction.png?alt=media" alt="Interactions tab with a Flow Navigation item under Next Button Click, and its editor showing Type Flow Navigation and a second Type field set to Next Screen" width="320"><figcaption><p>Next Button Click runs a Flow Navigation interaction set to Next Screen.</p></figcaption></figure>
{% endstep %}

{% step %}

### Create the Event

After the screen, add a **Create Records** element that creates one Event and sets its fields manually:

| Field               | Value                 |
| ------------------- | --------------------- |
| `Subject`           | `Onboarding call`     |
| `StartDateTime`     | `{!SlotPicker.value}` |
| `DurationInMinutes` | `30`                  |
| `WhoId`             | `{!recordId}`         |
| `OwnerId`           | `{!$User.Id}`         |

`SlotPicker.value` is the **Value** output of the picker: the selected slot as a single Date/Time.
{% endstep %}

{% step %}

### Confirm the booking

Add a last screen with a Display Text such as `Your onboarding call is booked for {!SlotPicker.value}.` so the customer hears the confirmed time before hanging up.
{% endstep %}

{% step %}

### Save and test

Save, then run the flow in **Debug** with a Contact Id in `recordId`. The week shows booked times as disabled. Select Tuesday 10:00: the **Book this time** button appears. Click it, and the confirmation screen shows the time.

Open the manager's calendar: a 30-minute Event named `Onboarding call` sits on Tuesday at 10:00, related to the Contact. Run the flow again and the 10:00 slot is now disabled.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>Display Next Button is missing from the Properties tab</summary>

The setting only shows when **Type** is Radio. With Checkbox, the customer can pick several slots and the flow uses the screen's standard Next button instead.

</details>

<details>

<summary>The Book this time button does nothing</summary>

**Display Next Button** only shows the button. Add the **Next Button Click** interaction with **Flow Navigation** set to **Next Screen**.

</details>

<details>

<summary>StartDateTime does not accept the picker output</summary>

Use **Value** (`{!SlotPicker.value}`), a single Date/Time. **Value Collection** is a Date/Time collection and fits a Loop, not a single field.

</details>

## Related tutorials

* [Block out booked times from Events](/flow/tutorials/components/date-time-picker/how-to-block-out-times.md): the busy-time loop this flow starts with.
* [Offer only working hours](/flow/tutorials/components/date-time-picker/offer-only-working-hours.md): hide weekends and evenings from the picker.
* [Book several time slots at once](/flow/tutorials/components/date-time-picker/book-several-time-slots-at-once.md): let the customer pick more than one slot.
* [Format dates and time zones](/flow/tutorials/components/date-time-picker/format-dates-and-time-zones.md): show times the way your customers read them.


---

# 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/build-an-appointment-booking-flow.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.
