Skip to content

Workflows: Authoring process

Back to Workflows.

Start with the business outcome, not the element list.

  1. Name the outcome: CreateProjectTask, SendDocumentReminder, ExportReport, ProjectAccessPolicy.
  2. Choose the trigger: button, field change, create/update/delete event, cron, policy, or another workflow.
  3. List the inputs: current resource, modal fields, request data, selected rows, current user, or schedule payload.
  4. List the outputs: saved resources, response data, client field updates, files, notifications, or policy constraints.
  5. Sketch the graph: load, branch, create, set, save, respond.
  6. Decide sync vs async. UI responses stay sync; long-running jobs become async.
  7. Add tests for the externally visible behavior.

Use source/new, op/set, and action/save when a workflow creates a resource from the current context.

{
"identifier": "CreateProjectTask",
"title": "Create project task",
"async": false,
"entry": "createProjectTask",
"elements": [
{
"name": "createProjectTask",
"type": "event/webhook",
"options": {
"module": "projects",
"refresh_prototype": true
},
"set": {
"project": "default:",
"data": "input:"
},
"to": {
"default": {
"newTask": ["default"]
}
}
},
{
"name": "newTask",
"type": "source/new",
"options": {
"module": "tasks"
},
"to": {
"default": {
"setTaskFields": ["default"]
}
}
},
{
"name": "setTaskFields",
"type": "op/set",
"options": {
"recipes": {
"title": "$data.title",
"project": "$project",
"status": "\"open\""
}
},
"to": {
"default": {
"saveTask": ["default"]
}
}
},
{
"name": "saveTask",
"type": "action/save"
}
],
"events": [
{
"identifier": "createProjectTask",
"type": "webhook",
"module": "projects"
}
]
}

Keep the first version this small. Add branching, notifications, and follow-up work only when the core create path is stable.

Use a modal when the workflow needs additional user input before changing data.

{
"name": "openTaskModal",
"type": "action/modal",
"options": {
"type": "confirm",
"layout": "tasks.modal",
"checkpoint": true,
"autosave_key": "task_create"
},
"set": {
"taskData": "confirm:"
},
"to": {
"confirm": {
"newTask": ["default"]
}
}
}

Follow the modal with source/new, op/set, action/save, and action/notify. Use neutral notification text that describes the result:

{
"name": "notifyTaskCreated",
"type": "action/notify",
"options": {
"toast": {
"type": "success",
"message": "Task created",
"description": "The task was added to the project."
}
}
}

Dashboard widgets, option loaders, and lightweight API-style calls often load records, transform them with recipes, and return a response.

{
"name": "buildSummary",
"type": "op/recipe",
"options": {
"recipe": "{\"open_tasks\": count($tasks), \"project\": $project.name}"
},
"set": {
"summary": "default:"
},
"to": {
"default": {
"sendSummary": ["default"]
}
}
}
{
"name": "sendSummary",
"type": "action/response",
"in": {
"default": "$summary"
}
}

Keep these workflows synchronous because the browser is waiting for the response.

Long work should not run inside the browser request. A common pattern is:

  1. A sync webhook validates the request.
  2. action/run starts an async workflow.
  3. The async workflow reports status with cast/progress.
  4. The workflow saves the result and sends a final notification.
{
"identifier": "PublishProject",
"title": "Publish project",
"async": true,
"entry": "publishProject",
"elements": [
{
"name": "publishProject",
"type": "event/webhook",
"options": {
"module": "projects"
},
"set": {
"project": "default:"
},
"to": {
"default": {
"showProgress": ["default"]
}
}
},
{
"name": "showProgress",
"type": "cast/progress",
"options": {
"title": "Publishing project",
"total": 3,
"progress": 1,
"send_to_user": true
}
}
]
}

For details, see Async Progress and Jobs and Cast.