# Form Event Trigger

> `UiPath.Forms.Activities.FormTriggerActivity<UiPath.Forms.Activities.FormInfoTriggerEventArgs>`

`UiPath.Forms.Activities.FormTriggerActivity<UiPath.Forms.Activities.FormInfoTriggerEventArgs>`

## Description

You can use this activity to trigger workflows based on an event happening inside a form. For example, you can choose to trigger a workflow when a form is closed, loses focus, or when a certain button was clicked, or a certain text field changed. If you have the **Form Trigger Activity** in any of your workflows, after you run the project, an argument named **TriggerEventArgs**, of type `TextTriggerEventArgs` appears in the **Arguments** panel.

:::note
* This trigger activity must be the first activity in the workflow.
* You can only use one **trigger** activity per workflow.
:::

## Project compatibility

**Windows**

## Configuration

**Designer panel**
* **Select Form** - Select the form file based on which you want to create a trigger. You can either choose an existent form file, or click Create new form and start building a form file.
* **Event** - Select the event in the form based on which you want the trigger to start. The default form events are:
  + Form closed
  + Form focus lost
  + Form focus gained
  + Form state changed (minimized/restored)
  + According to the form file you selected for Select Form, other events specific to the form components used in the form file show up. For example, for **Button** components, form events such as **Button clicked** appear.
* Message ID - The ID of the message sent from the form using `uipathApi.sendMessage`. You need this property only if you want to create a trigger for a custom HTML form.

When you pass data through the **Message ID** property, you are sending form events. For **uiform** files, pre-defined form events are available. However, for HTML forms, you must create the form events using the `uipathApi.sendMessage` JavaScript function. The process requires creating a form event, such as **"Reject clicked"**, within the HTML file. To create a trigger for this event, you must specify the event name in the **Message ID** property. For more information see [Design forms using custom HTML](https://docs.uipath.com/activities/other/latest/workflow/design-forms-using-custom-html).

**Properties panel**
* **Enabled** - When **Enabled** is **On**, the trigger starts when the chosen form event happens. When **Enabled** is **Off**, the trigger starts only if you explicitly enable it using the **Enable trigger** activity.
* **Scheduling mode** - It specifies how to execute the actions when a trigger is fired. Choose one of five options from the drop-down menu:
  + **Sequential** - Actions are executed one after another.
  + **Concurrent** - Actions execution can overlap.
  + **OneTime** - Executes one action and exits monitoring.
  + **Sequential Collapse** - Ignores all upcoming events, except the latest, until the current event finishes execution.
  + **Sequential Drop** - Stops the previous event execution and starts the next event.For **Sequential** and **Concurrent** modes the monitoring continues until either the user stops the execution or a [Break](https://docs.uipath.com/activities/other/latest/user-guide/break) activity is met.
* **Trigger ID** - The unique identifier of this trigger. The **Trigger ID** can be used with other activities, such as **Repeat trigger**.
* **Instance Name** - If you want to run the trigger only on an instance of a form file, input the instance name in this field. If you want to run the trigger for all instances of a form, leave this field empty.
