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

Triggers

Introduction

Triggers are the starting point of any automation workflow. They define "when" something should happen. Triggers are attached to "Targetables" (e.g., Models like Users, Documents, etc.) and serve as the anchor for automation rules.

When a Trigger matches an event or schedule, it evaluates its associated Conditions given by the HasConditions trait. If the conditions are met, it executes the linked Actions.

Triggers are typically accessed via the triggers relation on the targetable entity.

Model Definition

Relations

Key
Relation
Type
Relation Field(s)

actions

Morph Many

-

conditions

Morph Many

-

triggerDispatches

TriggerDispatch

Has Many

trigger_id

targetable

(Polymorphic)

Morph To

targetable_id, targetable_type

Traits

  • HasTargetable

  • HasConditions

  • HasActions

  • SoftDeletes

  • Sortable

  • HasFactory

  • Translatable

Supported Entities

The following entities support Triggers via the HasTriggers trait:

  • Form (Modules\Forms\Entities\Form)

  • TaskTemplate (Modules\Tasks\Entities\TaskTemplate)

  • PlannedJob (Modules\Automation\Entities\PlannedJob)

  • Action (Modules\Automation\Entities\Action)

Create

Create a new Trigger.

Definition

POST /api/triggers

Request Keys

Key
Type
Default
Description

targetable_type*

string

-

Morph alias of the entity that should own the Trigger. Allowed values: action, form, plannedJob, taskTemplate.

targetable_id*

integer

-

ID of the targetable entity instance.

lang_id

string

system language

Language for translatable Trigger fields. If omitted, the system language is used.

title*

string

-

Display title of the Trigger.

allow_parallel

boolean

false

Whether multiple executions may run in parallel.

active

boolean

true

Whether the Trigger is active.

sort_number

integer

-

Sort order within the targetable context.

Keys marked with * are required.

Example Request

Example Response

Update

Update an existing Trigger.

Definition

PUT /api/triggers/{trigger}

Request Keys

Key
Type
Default
Description

targetable_type

string

-

Morph alias of the new targetable entity. Allowed values: action, form, plannedJob, taskTemplate.

targetable_id

integer

-

ID of the new targetable entity instance.

lang_id

string

-

Updated language for translatable Trigger fields.

title

string

-

Updated title of the Trigger.

allow_parallel

boolean

-

Updated parallel execution behavior.

active

boolean

-

Updated active state.

sort_number

integer

-

Updated sort order.

All keys are optional for Update.

Example Request

Example Response

Delete

Delete a Trigger.

Definition

DELETE /api/triggers/{trigger}

Example Request

Example Response

Last updated