MallaDocs

Acciones de flujos de trabajo

Cada paso de flujo de trabajo: qué hace, dónde se ejecuta y sus parámetros.

Guía de usuario

Cada paso de un flujo de trabajo ejecuta una acción. Los parámetros pueden ser valores fijos o expresiones; el resultado queda en steps.<stepId>. Las acciones de control de flujo (branch, switch, loop, parallel, try/catch, stop, log) funcionan tanto en flujos de trabajo de cliente como de servidor.

Acciones de cliente

Datos

AcciónParámetrosResultado
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.

Flujo de control

AcciónParámetrosResultado
If / else
core.branch
Runs then when the condition is truthy, otherwise else.
if Condition.
[then] lista de pasos
[else] lista de pasos
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] lista de pasos
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] lista de pasos
[catch] lista de pasos
{ 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] lista de pasos
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).

Navegación

AcciónParámetrosResultado
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.

Interfaz

AcciónParámetrosResultado
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.

Cuentas de visitantes

AcciónParámetrosResultado
Log in visitor
core.login
Signs a site visitor in with email and password and updates user.
Solo en el sitio publicado.
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.
Solo en el sitio publicado.
email Visitor email.
password New password.
name? Display name.
The new user.
Log out visitor
core.logout
Signs the visitor out and resets user.
Solo en el sitio publicado.
—null.
Send sign-in link
core.sendMagicLink
Emails the visitor a one-time sign-in link (same answer whether or not the account exists).
Solo en el sitio publicado.
email Visitor email.
true.
Refresh user
core.refreshUser
Reloads the signed-in visitor into user.
Solo en el sitio publicado.
—The signed-in user, or null.

Depuración

AcciónParámetrosResultado
Log
core.log
Writes a value to the run log (the browser console on the published site).
value Value to log.
The logged value.

Acciones solo de servidor

Disponibles en los flujos de trabajo de servidor, con reintentos opcionales por paso.

AcciónParámetrosQué hace
HTTP request
core.httpRequest
url, method, headers, bodyLlama a una URL HTTPS externa desde el servidor (sin direcciones privadas, 15 s, 1 MB).
Send email
core.sendEmail
to, subject, text, htmlEnvía un correo transaccional.
Run operation
core.runOperation
integrationId, operation, inputEjecuta una operación de una integración con sus secretos.
Run server workflow
core.runServerWorkflow
workflow, inputEjecuta otro flujo de trabajo de servidor y espera su resultado.
Run JavaScript
core.runJs
code, inputEjecuta código en un sandbox con la entrada y los pasos en el ámbito; sin red, bindings ni secretos.
Return
core.return
valueTermina la ejecución con un resultado; en los endpoints, es el cuerpo de la respuesta.
Query table
core.tableQuery
table, filter, limit, cursorLee filas de una tabla nativa. Resultado: { rows, nextCursor }.
Get row
core.tableGet
table, idLee una fila por id.
Insert row
core.tableInsert
table, valuesInserta una fila.
Update row
core.tableUpdate
table, id, valuesActualiza una fila.
Delete row
core.tableDelete
table, idElimina una fila.
Set visitor roles
core.visitorSetRoles
userId, rolesReemplaza los roles de un visitante. Los roles deben existir en el sitio.
Sleep
core.sleep
durationPausa la ejecución, p. ej. "5 minutes". Hace que el flujo de trabajo sea durable.
Wait for event
core.waitForEvent
event, timeoutPausa hasta que llega un evento de este tipo; el resultado es su payload. Durable.
Emit event
core.emitEvent
runId, type, payloadReanuda una ejecución que espera este tipo de evento.