MallaDocs

Workflow actions

Every workflow step: what it does, where it runs and its parameters.

User guide

Every step of a workflow runs one action. Parameters can be fixed values or expressions; the result lands in steps.<stepId>. Control-flow actions (branch, switch, loop, parallel, try/catch, stop, log) work in both client and server workflows.

Client actions

Data

ActionParametersResult
Set variable
core.setVar
Sets a variable, or a dotted path inside it (filters.category).
var Variable name or path, without vars.
value New value.
The value that was set.
Reset variable
core.resetVar
Restores a variable to its default value.
var Variable name or path.
The value after the reset.
Refetch query
core.refetch
Runs a client query again and waits for it.
query Query name.
The query state after the run (data, error, updatedAt).
Run operation
core.runOperation
Not available in client workflows: plugin operations need secret keys and run in server workflows.
integrationId Integration id.
operation Plugin operation id, e.g. rest.request.
input? Operation input.
Nothing: the step always fails in a client workflow.
Run server workflow
core.runServerWorkflow
Runs a server workflow called from pages (plugin operations, tables, emails) and waits for its result.
workflow Server workflow with the trigger "Called from pages".
input? Becomes input in that workflow.
The value of its Return step.

Control flow

ActionParametersResult
If / else
core.branch
Runs then when the condition is truthy, otherwise else.
if Condition.
[then] step list
[else] step list
The branch that ran: "then" or "else".
For each
core.loop
Runs body once per item, with item and index in scope (outer loop row in parent). At most 1000 items.
items An array (null or undefined runs zero times).
[body] step list
The number of iterations.
Try / catch
core.tryCatch
Runs try; if a step fails, runs catch with error in scope. Limits and cancellation are not caught.
[try] step list
[catch] step list
{ ok: true }, or { ok: false, error } when catch ran.
Switch
core.switch
Runs the steps of the first case whose value equals value, otherwise default.
value Value to match.
cases? Cases { id, label, equals } (at most 32); each id is a branch.
[default] step list
The id of the case that ran, or "default".
Run in parallel
core.parallel
Runs every lane at the same time and waits for all (at most 8 lanes). A failing lane fails the step.
—{ a: true, b: true, … } once every lane finished.
Break
core.break
Leaves the nearest For each loop. Only inside a loop body.
—Nothing.
Continue
core.continue
Skips to the next item of the nearest For each loop. Only inside a loop body.
—Nothing.
Wait
core.delay
Waits a number of milliseconds (at most 60000).
ms Duration in ms.
The milliseconds waited.
Stop
core.stop
Ends this workflow successfully. Later steps do not run.
—Nothing.
Run workflow
core.runWorkflow
Runs another workflow of the page and waits for it (call depth at most 8, no cycles).
workflow Workflow id.
input? Becomes input in the called workflow.
The called workflow's step results (steps).

Navigation

ActionParametersResult
Go to page
core.navigate
Navigates to a page of the site or a URL.
to A page ({ pageId }), a path (/about) or an http(s) URL.
Nothing.
Open URL
core.openUrl
Opens a URL (http, https, mailto, tel or a relative path).
url URL to open.
newTab? Open in a new tab.
Nothing.

Interface

ActionParametersResult
Show toast
core.toast
Shows a short notification.
message Text to show.
variant? Style.
Nothing.
Scroll to element
core.scrollTo
Scrolls an element into view.
node Node id.
behavior? Scroll behavior.
Nothing.
Copy to clipboard
core.copyToClipboard
Copies text to the clipboard.
text Text to copy (non-strings are JSON-encoded).
Nothing.
Play interaction
core.playInteraction
Plays an interaction (animation) of the page.
interaction Interaction id.
Nothing.

Visitor accounts

ActionParametersResult
Log in visitor
core.login
Signs a site visitor in with email and password and updates user.
Published site only.
email Visitor email.
password Visitor password (bind it to a form field).
The signed-in user.
Sign up visitor
core.signup
Creates a visitor account, signs it in and updates user.
Published site only.
email Visitor email.
password New password.
name? Display name.
The new user.
Log out visitor
core.logout
Signs the visitor out and resets user.
Published site only.
—null.
Send sign-in link
core.sendMagicLink
Emails the visitor a one-time sign-in link (same answer whether or not the account exists).
Published site only.
email Visitor email.
true.
Refresh user
core.refreshUser
Reloads the signed-in visitor into user.
Published site only.
—The signed-in user, or null.

Debugging

ActionParametersResult
Log
core.log
Writes a value to the run log (the browser console on the published site).
value Value to log.
The logged value.

Server-only actions

Available in server workflows, with optional retries per step.

ActionParametersDoes
HTTP request
core.httpRequest
url, method, headers, bodyCalls an external HTTPS URL from the server (no private addresses, 15 s, 1 MB).
Send email
core.sendEmail
to, subject, text, htmlSends a transactional email.
Run operation
core.runOperation
integrationId, operation, inputRuns an integration operation with its secrets.
Run server workflow
core.runServerWorkflow
workflow, inputRuns another server workflow and waits for its result.
Run JavaScript
core.runJs
code, inputRuns sandboxed code with input and steps in scope; no network, bindings or secrets.
Return
core.return
valueEnds the run with a result; for endpoints, the response body.
Query table
core.tableQuery
table, filter, limit, cursorReads rows of a native table. Result: { rows, nextCursor }.
Get row
core.tableGet
table, idReads one row by id.
Insert row
core.tableInsert
table, valuesInserts a row.
Update row
core.tableUpdate
table, id, valuesUpdates a row.
Delete row
core.tableDelete
table, idDeletes a row.
Set visitor roles
core.visitorSetRoles
userId, rolesReplaces the roles of a visitor. Roles must exist in the site.
Sleep
core.sleep
durationPauses the run, e.g. "5 minutes". Makes the workflow durable.
Wait for event
core.waitForEvent
event, timeoutPauses until an event of this type arrives; the result is its payload. Durable.
Emit event
core.emitEvent
runId, type, payloadResumes a run waiting for this event type.