MallaDocs

Actions de workflow

Chaque étape de workflow : ce qu’elle fait, où elle s’exécute et ses paramètres.

Guide utilisateur

Chaque étape d'un workflow exécute une action. Les paramètres peuvent être des valeurs fixes ou des expressions ; le résultat arrive dans steps.<stepId>. Les actions de contrôle du flux (branch, switch, loop, parallel, try/catch, stop, log) fonctionnent aussi bien dans les workflows client que serveur.

Actions client

Données

ActionParamètresRésultat
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.

Flux de contrôle

ActionParamètresRésultat
If / else
core.branch
Runs then when the condition is truthy, otherwise else.
if Condition.
[then] liste d'étapes
[else] liste d'étapes
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] liste d'étapes
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] liste d'étapes
[catch] liste d'étapes
{ 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] liste d'étapes
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

ActionParamètresRésultat
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

ActionParamètresRésultat
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.

Comptes visiteurs

ActionParamètresRésultat
Log in visitor
core.login
Signs a site visitor in with email and password and updates user.
Site publié uniquement.
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.
Site publié uniquement.
email Visitor email.
password New password.
name? Display name.
The new user.
Log out visitor
core.logout
Signs the visitor out and resets user.
Site publié uniquement.
—null.
Send sign-in link
core.sendMagicLink
Emails the visitor a one-time sign-in link (same answer whether or not the account exists).
Site publié uniquement.
email Visitor email.
true.
Refresh user
core.refreshUser
Reloads the signed-in visitor into user.
Site publié uniquement.
—The signed-in user, or null.

Débogage

ActionParamètresRésultat
Log
core.log
Writes a value to the run log (the browser console on the published site).
value Value to log.
The logged value.

Actions réservées au serveur

Disponibles dans les workflows serveur, avec des nouvelles tentatives facultatives pour chaque étape.

ActionParamètresEffet
HTTP request
core.httpRequest
url, method, headers, bodyAppelle une URL HTTPS externe depuis le serveur (pas d'adresses privées, 15 s, 1 Mo).
Send email
core.sendEmail
to, subject, text, htmlEnvoie un e-mail transactionnel.
Run operation
core.runOperation
integrationId, operation, inputExécute une opération d'intégration avec ses secrets.
Run server workflow
core.runServerWorkflow
workflow, inputExécute un autre workflow serveur et attend son résultat.
Run JavaScript
core.runJs
code, inputExécute du code dans un bac à sable, avec l'entrée et les étapes dans la portée ; sans réseau, liaisons ni secrets.
Return
core.return
valueTermine l'exécution avec un résultat ; pour les points de terminaison, c'est le corps de la réponse.
Query table
core.tableQuery
table, filter, limit, cursorLit les lignes d'une table native. Résultat : { rows, nextCursor }.
Get row
core.tableGet
table, idLit une ligne à partir de son id.
Insert row
core.tableInsert
table, valuesInsère une ligne.
Update row
core.tableUpdate
table, id, valuesMet à jour une ligne.
Delete row
core.tableDelete
table, idSupprime une ligne.
Set visitor roles
core.visitorSetRoles
userId, rolesRemplace les rôles d'un visiteur. Les rôles doivent exister dans le site.
Sleep
core.sleep
durationMet l'exécution en pause, par exemple "5 minutes". Rend le workflow durable.
Wait for event
core.waitForEvent
event, timeoutMet en pause jusqu'à l'arrivée d'un événement de ce type ; le résultat est sa charge utile. Durable.
Emit event
core.emitEvent
runId, type, payloadReprend une exécution qui attend ce type d'événement.