# Trigger

## Overview

Trigger is a mechanism that initiates an action when an event occurs such as reaching a certain time or date or upon receiving some type of input. A trigger generally causes a workflow to be executed.

{% hint style="info" %}
For instance, your application could execute a workflow at a specific time.
{% endhint %}

## Getting started

Navigate to your **Workspace > Apps** and click on the gear icon<img src="/files/-MBCo7T7BtG64Zwffv31" alt="" data-size="line"> to activate the configuration mode of your applications. Next, click on the gear icon<img src="/files/-MBCo7T7BtG64Zwffv31" alt="" data-size="line"> of the application you wish to configure. In the **Execution** section you click on **Trigger** to access the Trigger Designer. When you open the designer, as in other designers, the management window opens with the list of all created triggers.

![Trigger Designer](/files/-MYQOSwZ9U6F25_oH8bm)

Using the trigger management window, you can clone or delete existing trigger or create new trigger for your application.

## Trigger configuration

The trigger configuration window is divided in two sections, the trigger property fields and a section to configure the trigger.

![Trigger configuration](/files/-MYeeWQFkoVIi5Ka4Gd1)

### General

General configuration define the basic properties of your trigger with some descriptive information such as name and description.

### Trigger

In the trigger section, the kind of trigger is defined and the class assigned to the trigger is selected. The available trigger kinds are:

* Hook
* Time

{% hint style="info" %}
The **class** selection is compulsory when creating a trigger.
{% endhint %}

## Building your trigger

As mentioned before, there are two types of triggers that differ in the configuration settings.

### Hook

With a hook as a trigger, an insertion method, or specifically a workflow is executed (triggered) on a particular action.

![Trigger hooks](/files/-MYekDpiSk0sE81D5Niw)

Multiple hooks can be added to each trigger. A hook consists of the properties hook kind and a list of conditions. The **kind** of the hook is the action that will trigger this trigger when executed. Possible actions are create, update and delete.\
In the list of **conditions**, the conditions are entered that must be fulfilled when the action is executed. If the conditions are not fulfilled, the configured workflow will not be executed either.

### Time

If Time is selected as the type of hook, the **start time** for execution of a workflow can be selected. Also several times can be added.

![Trigger time](/files/-MYeoXNvOOwAIjfKm62b)

### Workflow

In the workflow tab, a workflow of the previously configured class can be selected. This workflow will be executed whenever this trigger is released.\
From the context menu on the right side of the selection field you can create a new workflow, edit the selected workflow and reload the list.

![Trigger workflow](/files/-MYesV4Q1tbxATGJ3HXr)

## Validate and save

You can also check the validity of your trigger configuration by selecting the **Validate** option or save your current configuration by selecting **Save** from the bottom menu.

![Validation error](/files/-MYeuNAkbUURJUEF2l4n)

Validation errors are displayed as toast notification at the top of the platform interface.

{% hint style="danger" %}
In case your trigger is invalid, the system will not allow it to be saved.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tivity.one/building-an-application/execution/trigger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
