> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/cloud/database/collections/schema-triggers.md).

# Schema Triggers

**Where:** Database → Collections → collection → **Triggers** · `/projects/<project>/db/schemas/<schemaName>/triggers/new · …/<triggerId>/edit`

{% hint style="info" %}
Screenshot TODO — capture comes from testing-plan area **02-triggers**.
{% endhint %}

Schema triggers fire on record events for **one collection**. That is why, unlike other modules, schema trigger API calls carry a `schemaId` (`sch_…`) next to the trigger id (`trg_…`). Collections that have triggers show a small flame icon in the Collections list — it deep-links to this tab.

## Fields

* **When** — the event: **When inserted**, **When updated**, or **When deleted**. The record's data is passed to the action as tokens (`@Model.…`); the update event also carries the record's previous values.
* **Then** — the action that runs: send an email, push, or SMS from a template, call a webhook, publish a realtime (SSE) event, run a code function, or run an installed marketplace function.
* **Name the trigger** (required) — e.g. `When an order is inserted, call the fulfilment webhook` — plus an optional **Description**.
* **Is this trigger enabled?** — a disabled trigger stays saved and editable but does not fire.
* **Order** and **Break execution queue on failure** — control the run order when several triggers listen to the same event, and whether a failure stops the ones after it.

How trigger actions and delivery settings work in detail is explained in [Triggers](/other-topics/triggers.md).

## Use it from code

[Database → Triggers](/sdks-and-cli/database/triggers.md)

## API reference

Endpoints: [Save Schema Trigger](/api-reference/database/schemas/save-schema-trigger.md).
