# State

A state inside a **State Machine**. When the flow enters this state, the entry activity runs first, then the triggers of the transitions leaving the state are awaited. Can only be added inside a **State Machine**.


---

### Usage

A state is opened by double-clicking it on the canvas. The opened view has three fields:

* **Entry**: Activity that runs when the state is entered.
* **Exit**: Activity that runs when leaving the state, before the transition's action.
* **Transition(s)**: List of the transitions leaving the state. Each row shows the transition's name and the target state (**Destination:**); clicking a transition opens its details.

A transition is drawn on the State Machine canvas by dragging from the edge of this state to the target state. Each transition has three fields:

* **Trigger**: The awaited event; an activity is placed here (e.g. **Delay**). If left empty, the transition is evaluated as soon as **Entry** finishes.
* **Condition**: `Boolean` condition evaluated when the trigger completes. If left empty, the condition is considered met. If the condition is not met, the trigger is restarted.
* **Action**: Activity that runs during the transition, after the **Exit** activity.

When a transition takes place, the state's other triggers are canceled; **Exit** and the transition's **Action** activity run, then the target state is entered.

* Every state that is not a final state must have at least one transition; otherwise a validation error occurs.
* An unconditional transition cannot share its trigger with another transition.
* The **Set as Initial State** command in the state's right-click menu makes it the initial state of the State Machine.