For the complete documentation index, see llms.txt. This page is also available as Markdown.

Schema triggers

Create a schema trigger — send an email, push or SMS, call a webhook, push a realtime event or run code when a record is inserted, updated or deleted.

Where: Database → Collections → row menu → Edit schema → Triggers tab → Add New (or the flame icon in the Collections list) · /projects/<project>/db/schemas/<schemaName>/triggers/new

A schema trigger runs an action every time a record of one collection is inserted, updated or deleted — no matter which app, script or AI tool made the change. The rules that are the same in every module are on the Triggers concept page.

Before you start

  • The collection exists and is published — see Create a schema.

  • For Call Webhook: a webhook destination subscribed to the matching event (database.record.inserted, …updated, …deleted) in Project → Settings → Webhooks. For Send Email / Push / SMS: an integration and a template of that channel, for example an email template.

  • You need database:update on the schema's triggers (database:trigger:<schemaId>).

Steps

  1. Open the collection's schema and switch to the Triggers tab. The list is titled Database Triggers. Press Add New.

    Editing books schema, Triggers tab: Database Triggers with an empty list and the Add New button
    The Triggers tab of the books schema.
  2. Under If this → Select trigger actions, pick the record event: When inserted, When updated or When deleted. Add activation code lets you add code that runs first and can stop the trigger.

  3. Under ... then, open the action picker and choose the action.

    Add New Trigger: When inserted is selected; the action list is open with Run Code, Send Email, Send Push Notification, Send SMS, Call Webhook and Send In-App (Realtime / SSE)
    The action picker.
    Action
    What it does

    Run Code

    Runs an installed marketplace function with the event data.

    Send Email / Send Push Notification / Send SMS

    Sends a template to the recipients you choose. The record's fields reach the template as tokens (@Model.title); an update also carries the previous values.

    Call Webhook

    POSTs a signed JSON envelope to the destinations you tick. Only destinations subscribed to the event can be picked; Save stays off until you tick one.

    Send In-App (Realtime / SSE)

    Delivers the event live to connected apps or AI agents.

  4. Fill the action's part of the form, then the trigger's own fields:

    Field
    Required
    What it does
    Example

    Send to webhook destinations (Call Webhook)

    yes

    The destinations that get the call.

    Fulfilment service (Subscribed)

    Order

    no

    Run order when several triggers listen to the same event; lower runs first.

    2

    Name the trigger

    yes

    The name in the list.

    Notify fulfilment about a new book

    Description

    no

    Free text.

    Sends every new book to the fulfilment service

    Is this trigger enabled?

    no

    On: the trigger runs. Off: saved but quiet.

    on

    Lower part of the trigger form: Send to webhook destinations with Fulfilment service (Subscribed, https://hooks.example.com/norbix/orders) ticked, Order empty, Name the trigger Notify fulfilment about a new book, Description, the switch Is this trigger enabled?, Cancel and Save
    A Call Webhook trigger, filled in.
  5. Press Save.

Result

The trigger is in the schema's Triggers list with When, What, Environment and Enabled, and the collection shows the flame icon on Database → Collections. The next matching record change runs the action — here, every new book is POSTed to the fulfilment service.

Database Triggers list with one row: Notify fulfilment about a new book, When inserted, Call Webhook, PROD, Enabled Yes
The saved trigger in the list.
  • Each trigger fires only for its own event and only in its own environment. Triggers reach PROD by promotion.

  • A destination that is subscribed to the event and chosen on a Call Webhook trigger gets two deliveries for one change: the plain one and the trigger one. Both carry the same eventId — de-duplicate on it, see Webhooks.

  • An Email / Push / SMS run that cannot send marks the trigger Needs attention in the list.

  • Old triggers with the legacy Code action show Code (not run) in the list: they are saved but never run.

Change or remove it later

Click the trigger's name in the list. The form opens as Edit Trigger, with the trigger id (trg_1p4R3gTobGZpD6fXvHT4rd) and an Actions menu.

Edit Trigger with the id trg_1p4R3gTobGZpD6fXvHT4rd and the open Actions menu: Disable, Delete trigger..., See documentation
Edit Trigger → Actions.
  • Edit — change any field and press Save. A trigger cannot move to another schema.

  • Disable / Enable — Actions → Disable keeps the trigger but stops it; a disabled trigger says Trigger is disabled, but you can still edit it.

  • Delete — Actions → Delete trigger..., then Delete in the confirmation (Are you sure you want to delete?). A schema with triggers cannot be deleted until its triggers are gone.

Do it from code

To create one from code, send saveSchemaTrigger with type: 'Schema', schemaId, name, when (OnInserted, OnUpdated, OnDeleted) and action. The client setup is on the Database page. API: Save Schema Trigger · Get Schema Triggers · Enable · Disable · Delete

Last updated

Was this helpful?