# Expression Syntax in Interactions

When you configure interactions in the Component Builder, several fields accept dynamic values — meaning the value changes based on what the user clicked, dragged, or selected. This page explains how dynamic values work and where you can use them.

## Item Variables

Item variables give you access to fields from the data record that the user interacted with. They're available on interaction events that involve a specific item — like clicking an event on a Calendar, clicking a row in a Data Table, or selecting a marker on a Map.

### Where Item Variables Appear

When you configure a field that supports item variables (such as the Value field on an input variable or the Modal Header field on an Open Flow Dialog), the dropdown displays your component's data fields alongside flow variables and static options.

For example, if your Calendar events are mapped from the `Event` object with fields Id, Subject, StartDateTime, and EndDateTime, the Value dropdown on an **Event Select** interaction shows:

* `Event.Id`
* `Event.Subject`
* `Event.StartDateTime`
* `Event.EndDateTime`
* Custom (for entering your own value)

The exact fields available depend on your component's data mapping. Only fields you mapped in the **Properties** tab appear as item variables in the **Interactions** tab.

### Which Events Expose Item Variables

Not all interaction events give you item variables. Only events tied to a specific data record do:

| Component                | Interaction events with item variables   |
| ------------------------ | ---------------------------------------- |
| **Calendar / Scheduler** | Event Select, Event Action Click         |
| **Data Table**           | Row Action Click, Cell Click, Row Select |
| **Map**                  | On Marker Select, On Marker Action Click |
| **Kanban**               | Card Select, Card Action Click           |
| **List**                 | Item Select, Item Action Click           |

Events that are not tied to a specific record (like New Event Drag, Toolbar Action Click, Empty Spot Action Click) do not expose item variables from your data. They expose their own context variables instead (see below).

## Context Variables

Context variables provide data about the interaction itself — such as the start/end times of a dragged area or the name of the button that was clicked. They're different from item variables because they don't come from your data mapping.

### Calendar / Scheduler Context Variables

| Interaction event           | Context variables in the Value dropdown                                                                                     |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **New Event Drag**          | **Start Date Time** — the start of the range the user dragged. **End Date Time** — the end of the range.                    |
| **Empty Spot Action Click** | **Start Date Time** — the start of the empty cell clicked. **End Date Time** — the end of the empty cell.                   |
| **Existing Event Drag**     | The event's name/key, plus its new start and end times (available through the component's output variables after the drag). |

These context variables appear in the **Value** dropdown when you add an input variable to an Open Flow Dialog, Open Flow Panel, or Navigate action.

> **Example:** On a Calendar's **New Event Drag** interaction, you configure an Open Flow Dialog with two input variables. The first variable's Value is set to **Start Date Time**, the second to **End Date Time**. When the user drags across Tuesday from 9 AM to 10 AM, the dialog flow receives `2024-03-12T09:00:00.000Z` and `2024-03-12T10:00:00.000Z`.

### Data Table Context Variables

Data Table interactions tied to rows (Row Action Click, Cell Click) expose item variables from the row's SObject. The action name is set through the **Target Name** field on the interaction.

### Where Else Dynamic Values Work

Beyond input variables, several other interaction fields support dynamic values through item variables:

| Field                                          | What you can do with it                                                                                              |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Modal Header** (Open Flow Dialog)            | Set the dialog title dynamically. E.g., show "Edit: {Event Subject}" by selecting the event's Subject item variable. |
| **Panel Header** (Open Flow Panel)             | Same as Modal Header but for the side panel.                                                                         |
| **Record Id** (Navigate to Record Page)        | Pass the record's Id from item variables so the navigation goes to the right record.                                 |
| **Record Id** (Open Quick Action)              | Associate the quick action with the specific record the user clicked.                                                |
| **Prefilled Values** (Navigate to Object Page) | Pre-fill fields on a new record form with values from the interaction context.                                       |
| **Prefilled Values** (Open Quick Action)       | Pre-fill quick action fields with item variable values.                                                              |
| **Toast Title and Message** (Show Toast)       | Include dynamic data in the toast. E.g., "Event {Subject} was updated."                                              |
| **Alert and Confirm Label/Message**            | Include dynamic data in alert or confirm dialog text.                                                                |

## Data Types and Formatting

Context variables from Calendar interactions (Start Date Time, End Date Time) are passed as **ISO 8601 text strings**, e.g. `2024-03-15T14:30:00.000Z`.

If your target flow needs a DateTime-typed variable, you have two options:

1. **Accept as Text, convert in the flow.** Create a Text input variable in the target flow. Use a Formula element with `DATETIMEVALUE()` to convert it.
2. **Accept as DateTime directly.** In some cases, the type conversion happens automatically if you set the input variable Type to `Date/Time` in the interaction configuration. Test this with your specific flow to confirm it works.

Item variables from SObject fields retain their original Salesforce data types (Text, Number, Date, DateTime, Boolean, etc.).

## Troubleshooting Dynamic Values

| Problem                                                    | Cause                                                                                             | Fix                                                                                                                                                                |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| The Value dropdown shows "Custom" but no context variables | You're on an interaction event that doesn't expose context variables (e.g., Toolbar Action Click) | Context variables are only available on events that involve a time range or a data record. Use a flow variable or static value instead.                            |
| The Value dropdown shows no item variables                 | Your component doesn't have a data mapping, or the interaction event doesn't expose item data     | Check that your component has data configured in the Properties tab. Only Event Select, Event Action Click, and similar "item-level" events expose item variables. |
| The target flow receives empty/null values                 | The input variable Name doesn't match the target flow variable name                               | Verify the Name is an exact match (case-sensitive). Also confirm the variable is marked "Available for Input" in the target flow.                                  |
| DateTime values appear as text in the target flow          | Context variables from Calendar are ISO 8601 strings                                              | Set the target flow variable to Text type and convert with a Formula, or test with Date/Time type to see if auto-conversion works.                                 |
