Skip to content
MyAppBuilder
StableGuide

Workflow steps (nodes)

Steps are the Then part of a workflow. They run one after another along the chain you build on the canvas, and some of them split the chain into paths. There are 12 step types; click + anywhere in the chain to insert one.

Workflow steps (nodes)

Steps are the Then part of a workflow. They run one after another along the chain you build on the canvas, and some of them split the chain into paths. There are 12 step types; click + anywhere in the chain to insert one.

The 12 steps

GroupStepWhat it does
CommunicationSend emailEmails a customer or your team
CommunicationNotificationLeaves an in-app notification for your team (shown in Run history)
CommunicationSend webhookSends the record and results as JSON to another service
DataDatabaseCreate, update, delete or find records
DataSet valuesComputes named values for later steps
DataCall APICalls one of your API sources
LogicIf / elseContinues on the Yes or No path
LogicBranchSeveral paths; the first matching case runs, otherwise Otherwise
LogicRepeat for eachRuns the steps inside once per item of a list
LogicWaitPauses up to 10 seconds
MoreAI stepGenerates text from a prompt
MoreRun actionRuns another workflow, or a Send email / Create / Update / Delete record action

How to add and configure a step

  1. Open the workflow in Logic → Workflows.
  2. Click the + below the trigger or between two steps ("Insert a step here"), then pick a step.
  3. The new step opens in the right-hand panel. Give it a Step name (this is what Run history shows) and fill in its settings.
  4. Fields with a data picker accept the triggering record (Current record › Email), results of earlier steps (Action results › key), event data, the current user, or a text template.
  5. To delete a step, click the bin icon on its card or Delete step in the panel. Deleting an If / else, Branch or Repeat step also deletes the steps inside its paths (you are asked to confirm).

How values flow from one step to the next

Steps that produce data have a Save result as field. Give it a short key, and every later step can read it:

  • In the data picker: Action results › key.
  • In a template: {{results.key}}, with dot paths for nested values, e.g. {{results.customer.id}}.

Which steps produce results:

  • Database → Create record saves the created record under the key (so {{results.created.id}} is its id).
  • Database → Find records saves the records that match its filters as results.<key> and how many match as results.<key>_count (plus exact totals with aggregate, see below); loop over the list with Repeat for each, or compare the count in an If / else (capacity, usage limits, duplicates).
  • Stop with message ends the run as failed with your message — a button or form that started the workflow shows it to the user. Earlier changes are kept (a step that fails with an error instead rolls back the run's changes when a button or form started it).
  • Call API saves the mapped response.
  • Set values saves each of its named values.
  • AI step saves the generated text.

Other values available in every step: {{record.field_key}} (the triggering record), {{event.name}} (inputs), {{event.item}} inside a Repeat for each, and the user who caused the run: {{user.email}}, {{user.name}}, {{user.role}} (the role's display name) and {{user.roleId}} (the role's stable id — use this one for role checks, see below).

Example
1. Database   Create record → Customers, Name = {{record.name}}, save as "customer"
2. Database   Create record → Jobs, Title = "Job for {{record.name}}", Customer = Action results › customer.id
3. Send email To = {{record.email}}, Subject = "We've created your job"

Paths and ordering

  • If / else has a Yes and a No path. Branch has one path per case plus Otherwise. Steps placed after the paths rejoin the main chain.
  • Repeat for each has an inner For each item box. Steps after the box run once the loop is done.
  • A step that fails stops the run; later steps are not executed and the run is marked failed with the step's error.

Rule primitives (business platform)

Beta. These additions let a workflow enforce stock, booking, duplicate and role rules on the server, even when several people submit at the same moment, and run work on a schedule. You can build them in the step panels (see Editing rule steps in the builder below) or write them in an app plan — both produce exactly the same workflow.

Editing rule steps in the builder

Beta. Click + in a workflow: besides the 12 steps, the picker offers three ready-made ones — Find records, Calculate and Run another workflow. Every change is checked with the same rules the server uses; a setting the server would refuse is not saved and the problem is shown under it in red. Each section has a ? with a short explanation.

  • Find records (a Database step with Find records): filters, sort, Max records and Save result as as before, plus
  • Total of a field: pick a number field. The panel lists what later steps can use: {{results.key}}, _count, _sum, _min, _max.
  • Only records whose dates overlap a range: pick the field where a record starts and the one where it ends, then Requested from / Requested to (usually inputs such as Event › start). Needs a Date or Date & time field.
  • Peak: available once a total and the date overlap are set; adds _peak. Turning off the total or the overlap also turns off the peak.
  • Calculate (a Set values step): each value is either a Value (data picker) or a Calculation. Type the formula, or click the chips to insert earlier results, the workflow's inputs, number and date fields of the triggering record, operators and the allowed functions (hover a function to see its arguments). The formula is checked as you type (Valid formula, or the reason it isn't). Store the result as Number or Date (YYYY-MM-DD, for add_days / add_months).
  • Run another workflow (a Run action step, What to run → Another workflow): choose the workflow, fill its Inputs (the names it reads as {{event.<name>}} are listed automatically; add others by name), tick Must succeed for required, and use Save result as to keep its results. Run it once for each item of a list wraps the step in a Repeat for each (its items and At most are edited in the same panel; Run once instead undoes it).
  • Stop with message: the message accepts templates such as {{results.balance}}.
  • Reject duplicates (trigger panel of a Run manually workflow): the value that must not repeat (e.g. Event › reference), the message shown for a duplicate and how long keys are remembered (in hours; 720 = 30 days).
  • Schedule (trigger panel): type the schedule; the plain-words preview (Every weekday at 08:30) or the reason it isn't understood updates as you type, and only a valid schedule is saved. Also run on test data runs the draft on test data.
  • Role checks: in any condition (If / else, Branch, the trigger's Only if, a component's Show only when) click Add role check: Current user's role is (not) one of plus a checkbox per role. It writes a check on {{user.roleId}} with role ids, so renaming a role never breaks it. A condition that compares Current user › role (the display name) shows a warning with Switch to a role check.

1. Totals over found records

A Find records step can also total one numeric field over every matching record (not just the ones kept by Max records):

Example
{ "type": "find_records", "entity": "Stock Movements",
  "where": [{ "field": "Product", "op": "eq", "value": "{{event.product}}" },
            { "field": "Location", "op": "eq", "value": "{{event.location}}" }],
  "aggregate": "Quantity", "limit": 1, "as": "onhand" }

Results: {{results.onhand}} (records), {{results.onhand_count}}, {{results.onhand_sum}}, {{results.onhand_min}}, {{results.onhand_max}}. Sums are exact decimals with 6 decimal places (0.1 + 0.2 is 0.3); empty and non-numeric values are skipped; _sum is 0 and _min / _max are empty when nothing matches.

2. Calculations

A calculate step stores an exact number in {{results.<as>}}:

Example
{ "type": "calculate", "as": "balance", "formula": "{{results.onhand_sum}} - {{event.quantity}}" }

Allowed: numbers, {{references}}, + - * / (also × ÷ −), parentheses, unary minus and min(a, b, …), max(a, b, …), round(x, places) (places 0–6, half away from zero) and abs(x). Nothing else is accepted — the formula is turned into a small allowlisted structure when the plan is compiled and checked again when the workflow is saved; it is never run as code. A reference with no value, a non-number or a division by zero fails the step.

Dates. Three calendar functions work on dates (YYYY-MM-DD or a date-time, read as a UTC calendar date — the time of day is dropped): add_days(date, n), add_months(date, n) (the day is clamped: 31 Jan + 1 month = 28/29 Feb) and days_between(from, to) (whole days, negative when to is earlier). Add "format": "date" to store the result as YYYY-MM-DD:

Example
{ "type": "calculate", "as": "next_due", "format": "date",
  "formula": "add_months({{results.plan.0.next_due_date}}, {{results.plan.0.interval_months}})" }

n must be a whole number; an unreadable date fails the step.

Date and time (hours and minutes). Four functions work on exact instants (UTC): add_hours(datetime, n), add_minutes(datetime, n) (n may be decimal: 1.5 hours = 90 minutes), hours_between(from, to) and minutes_between(from, to) (exact decimals with 6 places, negative when to is earlier). Their arguments are date-times — YYYY-MM-DDTHH:mm, with seconds, or with a zone (Z, +02:00, converted to UTC); a value without a zone is read as UTC, a date alone is its midnight UTC, and {{now}} is the current instant. Elapsed time is exact across daylight-saving changes (24 hours is always 24 hours). Add "format": "datetime" to store an instant as YYYY-MM-DDTHH:mm:ssZ (a date-time field keeps it as UTC YYYY-MM-DDTHH:mm), or "format": "date" for its UTC calendar date:

Example
{ "type": "calculate", "as": "due", "format": "datetime",
  "formula": "add_hours({{results.t.0.opened_at}}, {{results.sla.0.resolution_hours}})" }
{ "type": "calculate", "as": "margin", "formula": "hours_between({{now}}, {{results.t.0.due_at}})" }

margin is the number of hours left until the due time (negative once it has passed) — compare it with 0 in an If / else to decide "SLA met". Date and date-time functions nest (add_days(add_hours(x, 20), 1)); an unformatted add_hours result is a number (milliseconds since 1970) that other date-time functions read back.

Business hours (beta). Four more functions count only working time — nights, weekends and holidays don't count: add_business_hours(datetime, n), add_business_minutes(datetime, n), business_hours_between(from, to) and business_minutes_between(from, to). They use the app's business calendar (Mon–Fri 09:00–17:00 in the app's time zone unless you set your own under Settings → General → Business hours); give a calendar key in quotes as the last argument to use another one: add_business_hours({{results.t.0.opened_at}}, 8, "support"). See Business hours and SLA clocks.

3. Date range overlap

A Find records step can keep only records whose range overlaps a requested range — the building block of "is this resource free?":

Example
{ "type": "find_records", "entity": "Bookings",
  "where": [{ "field": "Resource", "op": "eq", "value": "{{event.resource}}" },
            { "field": "Status", "op": "in", "value": "Provisional,Confirmed,Picked up" }],
  "overlaps": { "start": "Start", "end": "End", "from": "{{event.start}}", "to": "{{event.end}}" },
  "as": "clash" }

Ranges are half-open — [start, end) — so a booking ending at 10:00 doesn't clash with one starting at 10:00. Dates and times without a timezone are read as UTC. A record without an end blocks everything after its start. A missing range, or an end that isn't after its start, fails the step.

Capacity greater than one — the peak. Add "aggregate": "Quantity" and "peak": true: {{results.held_peak}} is the largest number of units held at any one moment inside the requested range (an exact sweep over the overlapping bookings, clipped to the range). Bookings 09:00–11:00 and 11:00–13:00 of 1 unit each never coexist, so a request for 10:00–12:00 sees a peak of 1, not 2. Compare peak + requested quantity with the capacity:

Example
{ "type": "find_records", "entity": "Bookings", "as": "held", "limit": 1,
  "where": [{ "field": "Resource", "op": "eq", "value": "{{event.resource}}" },
            { "field": "Status", "op": "in", "value": "Confirmed,Picked up" }],
  "overlaps": { "start": "Start", "end": "End", "from": "{{event.start}}", "to": "{{event.end}}" },
  "aggregate": "Quantity", "peak": true }

_sum stays available (every overlapping booking added up — more conservative than the peak); _peak is 0 when nothing overlaps. peak needs both overlaps and aggregate.

4. Atomic runs, duplicates and retries

  • Data lock. A workflow started by a button, a form or a test run executes under its project's data lock: its Find records checks and the writes after them are one transaction, and concurrent runs (and record writes) of the same project and data environment wait their turn. Two people issuing the last 3 units at the same instant: one succeeds, the other gets your Stop message. Unique fields are checked under the same lock.
  • Rollback. If a step fails with an error, every record the run created, updated or deleted is rolled back (a transfer's two movements are written together or not at all). A Stop step keeps the writes made before it — put checks before writes. Emails, webhooks and API calls already made are not undone. Workflows that react to the run's records start after the commit.
  • Reject duplicates by key. On a manual workflow:

``json { "name": "Receive stock", "when": { "event": "manual" }, "dedupe": { "key": "{{event.reference}}", "message": "Receipt {{event.reference}} was already posted." }, "then": [ … ] } ``

After a successful run with that key (compared case-insensitively), a later run with the same key is rejected with the message — even when both arrive at once. Keys are remembered 30 days (ttlHours, up to 8760). An empty key disables the check for that run.

  • Request retries. The run-action API also accepts an optional idempotencyKey (one per submission): a retried request gets the first run's result instead of running twice.

5. Role checks by stable role id

Every role has a stable id that never changes when the role is renamed: role_owner, role_admin, role_staff, role_viewer, role_customer, role_public, and role_<key> for a custom role. Compare {{user.roleId}} with ids — never {{user.role}} (the display name, which changes when someone renames the role):

Example
{ "type": "if", "name": "Dispatcher?", "left": "{{user.roleId}}", "op": "not_in", "right": "role_owner,role_admin,role_dispatcher",
  "then": [{ "type": "stop", "message": "Only dispatchers and supervisors can do this." }] }

Custom roles are created in Users → Roles & permissions → New role (the id is shown as you type: role_<name>) or declared in the plan and created as real roles (id role_<key>; the key uses lowercase letters, digits and _):

Example
"customRoles": [
  { "key": "dispatcher", "name": "Dispatcher", "description": "Approves, assigns and schedules jobs." },
  { "key": "technician", "name": "Technician" },
  { "key": "supplier", "name": "Supplier", "external": true }
]

Use the key in page and component roles ("roles": ["dispatcher", "staff"]) and in permissions ({ "role": "technician", "entity": "Work Orders", "operations": ["read"], "where": [...] }). A custom role has no access to any data until a permission rule grants it (deny by default; built-in roles keep their defaults). Pages with "audience": "team" include every custom role that isn't external. Owners and admins always pass page and component checks. Renaming a role (built-in or custom) in the editor changes {{user.role}} only — checks on {{user.roleId}}, page access and permission rules keep working.

6. Scheduled workflows

A workflow can run on a schedule instead of a button:

Example
{ "name": "Generate due maintenance", "when": { "event": "schedule", "schedule": "every day at 06:00" },
  "then": [ … ] }

Schedules (case-insensitive; 24-hour times in the app's time zone from Settings → Time zone, UTC when unset):

ScheduleRuns
every hour (or hourly)at minute 0 of every hour
every hour at :30at minute 30 of every hour
every day at 09:00 (or daily 09:00)once a day
every weekday at 08:30Monday to Friday
every monday at 08:00 (any day name)once a week
every month on day 1 at 07:00days 1–28

Anything else is refused when the workflow is saved. How it runs:

  • Published apps, live data. The server's workflow cron (/api/workflows/cron) runs due occurrences of the published version against live data. Add "runOnTestData": true to when to also run the draft's version against test data.
  • Once per occurrence. Each occurrence (workflow + scheduled time) is claimed under the project's data lock and recorded, so a retried or overlapping cron call never runs it twice. A run that fails with an error is rolled back and retried at the next tick; a Stop counts as done.
  • Catch-up. Occurrences are checked when the cron ticks. Missed occurrences are not replayed one by one: at most one run per workflow per tick, for the latest occurrence of the last 26 hours (on Vercel Hobby the cron ticks once a day, so an hourly schedule runs once a day there — see Deployment).
  • No signed-in user. {{user.email}} is empty and {{user.roleId}} is role_public; {{event.occurrence}} (UTC instant), {{event.date}} and {{event.time}} (in the app's time zone) and {{event.schedule}} describe the occurrence.
  • Previews and the public demo never run schedules on their own: use Test run (Run now) in the builder, or a button with Run workflow.

7. Run another workflow (and repeat for each)

Example
{ "type": "run_workflow", "workflow": "Create preventive work order",
  "forEach": "{{results.due}}", "max": 50, "input": { "plan_id": "{{event.item.id}}" } }

Runs a workflow of the plan by name with input as its {{event.<key>}} values; with forEach (a list from an earlier step) once per item, the item being {{event.item}} while the inputs are evaluated (at most max, default 100, up to 500). By default the called workflow's Stop or failure doesn't stop the caller (each run has its own entry in Run history) — right for a batch where one item may be refused. Add "required": true when the caller depends on it: a Stop in the called workflow then stops the caller with the same message, and a failure fails the caller (its writes are rolled back). Without forEach, "as": "key" saves the called run's results as {{results.key}}. Calls nest at most 3 levels and run inside the caller's data lock and transaction. A manual workflow that no button references can only be started this way (or by a test run) — app users can't call it directly.

Keep slow steps (Wait, Call API, Webhook, AI step) out of workflows that check and write records — the lock is held for the whole run.

8. Notify app users (plan step)

Example
{ "type": "notify_user", "to": { "email": "{{results.t.0.customer_email}}" },
  "title": "{{results.t.0.ticket_number}} is resolved", "body": "{{event.resolution}}",
  "link": { "page": "Request", "entity": "Tickets", "record": "{{results.t.0.id}}" }, "emailCopy": false }

Compiles to the Notify app user step (beta): a bell notification for people using your app. to is either { "email": … } (one or more addresses; addresses without an app account are skipped) or { "role": "dispatcher" } (a built-in or custom role key: every app user with that role, up to 200). Recipients who can't read the run's record are skipped by the server. link opens a page of the plan by name — for a page with a :id route, record is the record id and entity its table (when it isn't the triggering record's). emailCopy: true also emails it. An unknown role or page is refused when the plan is checked. Previews and the public demo capture notifications instead of delivering them.

Common mistakes

  • Using a result key before it exists. Keys are only available to steps after the one that saved them.
  • Keys with spaces or dashes. Keys allow letters, numbers and underscores only.
  • Wait longer than 10 seconds. A workflow step pauses at most 10,000 ms (the Wait action on a button allows 30 s).
  • Choosing an entity but no field values. A Create record step with no values creates an empty record (required fields will make it fail).

Advanced

Node configs store bindings or plain template strings; a string containing {{ is treated as a template. Database steps inside workflows run with system privileges (no permission rules), while Find records runs as the app owner. The executor limits a run to 200 steps and nested sub-workflows to 3 levels.

Related

Was this helpful?