Skip to content
MyAppBuilder
StableWorkflow trigger

Run manually / from an action

Overview

The workflow runs only when you ask: from a button with the Run workflow action, or with Test run.

Purpose

Deliberate operations a person starts: approve a quote, generate an invoice, send a batch of reminders, recalculate totals.

Inputs

  • Works on a record of (optional) — choose an entity so steps can use Current record when the workflow is started from a row, card or detail page of that entity.
  • Only if (optional) — a condition on that record.
  • Reject duplicates by key (beta, plan / config level) — a key evaluated when the run starts, e.g. {{event.reference}}. After a successful run with that key, a later run with the same key (case-insensitive) is rejected with your message instead of running twice. Keys are kept 30 days by default.

Configuration

  • Save values you want to return to the app with “Save result as” — the Run workflow action receives them as its result.
  • Disable the workflow to block it from being started.

Outputs

  • {{event.<name>}} — the inputs given in the Run workflow action (or the Input JSON of a test run).
  • Current record — the record in scope where the button lives (table row, detail page), when an entity is set.
  • Available data in every step: Current record / {{record.field_key}} (the record that triggered the run), Event / {{event.name}} (inputs passed to the run; {{event.before.field_key}} holds the previous values after an update), Action results / {{results.key}} (values saved by earlier steps) and Current user / {{user.email}} (whoever caused the run; for test runs, you).

Example

Generate an invoice from a job

Example
Trigger: Run manually · Works on a record of: Jobs
Step 1  Database › Create record  Invoices  (Job = {{record.id}}, Amount = {{record.total}})  → save as invoice
Step 2  Send email  To: {{record.customer_email}} · Subject: Invoice {{results.invoice.id}}

Button on /jobs/:id → Run workflow “Generate invoice”

Errors

  • Errors are returned to the button that started the run (“<step>: <error>”) and recorded in Run history.

Limitations

  • The person pressing the button waits for the run to finish; keep manual workflows short.
  • Manual runs hold the project's data lock for their whole duration (one at a time per project and data environment): avoid Wait, Call API, Webhook and AI steps in workflows that check and write records.
  • If a step fails with an error, every record write of the run is rolled back; a Stop step keeps writes made before it (put checks first). Emails, webhooks and API calls already made are not undone.

Advanced

  • Trigger: { type: "manual", entityId?, condition? }. The Run workflow action calls runWorkflow(ctx, wf, { type: "manual", input, record, entityId }) (rate limited to 30/min per user).
  • Dedupe: trigger.dedupe = { key: Binding, message?, ttlHours? } (default 720 h). Requests may also carry an idempotencyKey (actions API body, 8–200 chars, scoped per user): a repeat returns the first run's results. Keys of succeeded runs are stored in workflow_idempotency_keys inside the run's transaction; expired keys are purged lazily.
  • Manual, form-submitted and test runs execute inside withDataLock() (src/server/db/lock.ts): one transaction, an in-process mutex per project + data environment and, on Postgres, pg_advisory_xact_lock (transaction-scoped, safe behind transaction poolers). getDb() returns that transaction inside the lock, so every read and write of the run joins it.

Related

Was this helpful?