Skip to main content

Generation triggers

What this page is — rules that create a document automatically when something happens elsewhere in Orbit: an order placed or paid, a deal won, a form submitted.

What it is for — so the documents that follow predictably from an event — the invoice after payment, the agreement after a won deal — exist without anybody remembering to make them.

The problem it solves — documents that should follow automatically from an event depend on someone remembering to create them.

Route: /org/settings?tab=papers → Generation triggers · Permission: Configure triggers/webhooks/auto-generation rules..

Figure 1 — Each trigger joins an event to a document type.

1. What it is​

A trigger joins one event to one document type. The events are a curated list — a typed event name that is never published would produce a trigger that silently never fires.

EventPublished whenDefault source mapTitle example
Order paid order.paidA customer order is marked paidorder_id ← order.idTax Invoice for {{order.number}}
Order placed order.placedAn order is created, not yet paidorder_id ← order.idProforma Invoice for {{order.number}}
Deal won deal.wonA CRM deal moves to wondeal_id ← deal.id, contact_id ← contact_idAgreement — {{deal.title}}
Intake form submitted form.submittedA marketing or intake form is submittedform_id, submission_idRequest from {{event.fields.customer_name}}

How an event becomes a document:

StepWhat happens
1The publishing module writes the event to the Papers outbox, in its own transaction
2The outbox worker picks it up — about every minute
3Each active trigger for that event creates a document from the type's published version, in the event's project
4The source map links the document to the record, so merge sources like order.* and deal.* fill fields
5Optionally, the document is submitted and/or finalized automatically
6Redelivery of the same event does not generate a second document

2. Why you would use it​

  • The late documents stop being late. Invoices after payment and agreements after a won deal are the ones that wait on someone noticing.
  • Data flows in, not typed in. The order or deal fills the document through merge sources.
  • Fully hands-off, if you want. With auto-finalize an invoice is numbered and sealed the moment payment lands.
  • Safe under retries. The outbox is at-least-once; generation is idempotent.

3. Step by step​

  1. + Trigger → pick the Event.
  2. Pick the Document type — only active, published types are offered.
  3. Write a Title template, starting from the example.
  4. Keep the default Source map unless you know the payload.
  5. Choose Auto-submit and Auto-finalize.
  6. Save and leave it active. Cause the event once in a test project and check the documents list.

4. Field reference​

FieldRulesRefusal
EventOne of the fourevent_type is required
Document typeIn scope, active, publishedtype_id does not reference a document type in this scope · at generation: target type has no published version
Title templateTokens from the event payload—
Source mapDocument reference key → payload pathsource_map must be a JSON object of source_ref key -> payload path
Auto-submitSubmits the generated draftSubject to the lifecycle's rules
Auto-finalizeSeals the generated documentNumbered from the type's sequence; a failure is recorded, and the draft remains
ActiveOn / off—
A source map key the payload does not carry fills nothing

The panel offers only keys each publisher actually sends. Editing the map to a path that is not in the payload produces documents whose merge fields are silently empty.


5. Worked example​

A storefront finance team wants a tax invoice for every paid order.

SettingValue
EventOrder paid
Document typeTax Invoice
Title templateTax Invoice for {{order.number}}
Source maporder_id ← order.id (default)
Auto-finalizeOn

Order SO-10429 is paid at 14:02. At about 14:03 the list shows Tax Invoice for SO-10429, already finalized: number INV/2026-27/00118, sealed PDF, line items and customer filled from the order via order.* merge sources.

The payment gateway retries the webhook at 14:05. No second invoice appears.

A month later someone retires the Tax Invoice type while drafting a new one. Paid orders now generate nothing — target type has no published version in the outbox audit — until they publish the replacement and point the trigger at it.


6. The admin contract​

Must be trueWhereWhat breaks without it
The role holds Configure triggers/webhooks/auto-generation rules.Role editorThe section is missing
The type is active and publishedType DesignerGeneration fails, recorded only in the outbox audit
The type's fields use matching merge sourcesFieldsDocuments arrive empty
A numbering sequence is bound, for auto-finalizeBehaviourInvoices seal unnumbered
The outbox worker job is enabledJob monitorEvents queue and nothing is generated

7. Downstream​

When…Then
The event firesA document appears in the event's project
Auto-finalize is onIt is numbered and sealed at once
You deactivate a triggerFuture events generate nothing; past documents stay

8. Don't confuse this with…​

Intake formsForm-specific bridges with a field map. Both can fire on one submission
WebhooksPapers telling other systems about documents
Capture inboxFiles arriving from outside

9. Troubleshooting​

SymptomCause
No document was generatedTrigger inactive, type unpublished, outbox worker off, or the event happened in another project
Fields are emptyThe type's fields lack matching merge sources, or the source map was edited
Two documents per form submissionA trigger and an intake bridge both listen
An auto-finalized document has no numberThe type binds no sequence
A retried event created nothing newIdempotency — expected