Skip to content

Automations

An automation is trigger code plus the configuration binding it to an entity. Both deploy together as configuration.

automations/
Issue/
ApplyDefaults.ts
GuardClosed.ts
Component/
SyncOwner.ts

The directory name is the entity. Every class inside runs on that entity’s changes, according to the interfaces it implements.

Several automations on one entity all run. Do not depend on the order between them — if step B needs step A’s output, put both in one class where the sequence is explicit.

Runs are recorded, so you can see what fired and when. A trigger that throws fails the operation that triggered it: a failing beforeInsert blocks the insert. That is deliberate — silent partial success on a validation rule is worse than a visible error.

SituationPut it in
Must happen with the write, atomicallyTrigger
Must reject bad inputbefore* trigger
Slow, or calls a modelScheduled job
Serves a custom UIController

Triggers run inside the user’s save. Anything slow there makes saving slow, and an AI call in a trigger is felt on every record.

Terminal window
polymesa deploy ./config --dry-run
polymesa deploy ./config