# Workflows

> Workflows automate the work that follows a save. Send email, request approvals, create documents, call other systems, and update records on a schedule.

A workflow is an automated process. It can read and write records, send email, ask someone to approve, wait, create a PDF or spreadsheet, and talk to other systems. You build it on a visual canvas by connecting steps.

[Business rules](/docs/business-rules) keep a single save correct. Workflows carry the work that continues after that: the confirmation email, the approval, the invoice PDF, the nightly sync.

## How a workflow starts

| Trigger | How it works |
| --- | --- |
| **A button on a record** | A header button on the [record page](/docs/views/record-page) starts the workflow and passes the open record. |
| **A business rule** | A [side effect](/docs/business-rules/side-effect) starts the workflow after a save has been committed. |
| **A schedule** | The workflow runs on a timetable, for example every weekday at 07:00. |
| **Another workflow** | A **Subflow Call** step starts it, and can wait for it to finish. |
| **An email** | A shared inbox passes each incoming message to the workflow. |
| **By hand** | You start it yourself and enter its inputs, for example while testing. |

Each run records what started it.

## Create a workflow

1. Open the **Workflows** tab in the sidebar and click **New workflow**.
2. Name the workflow. You land on the canvas with a **Begin** step.
3. Open **Triggers** and add the inputs the workflow needs under **Input parameters**, such as the record it works on. Each input appears as an output on the **Begin** step.
4. Open **Palette** and drag steps onto the canvas, or search for them by name.
5. Connect the steps. Execution connections set the order steps run in. Value connections carry data from one step to another.
6. Click **Publish** once, then click **Test** to run it and watch each step.
7. When it works, click **Publish & Enable** to make it live.

> **Tip:** Ask the AI Assistant to build a first version of a workflow from a description, such as "when an order is confirmed, create the order PDF, attach it to the order, and email the customer". Then review and adjust it on the canvas.

## The canvas

### Steps and values

Some steps do something and run in order, such as **Send Email** or **Write DataView**. Others only produce a value, such as a sum or a formatted date, and are calculated when a later step needs them. See [Workflow steps](/docs/workflows/nodes) for the full catalog.

### Side panels

| Panel | What it's for |
| --- | --- |
| **Palette** | Every step you can add, grouped by category. |
| **Variables** | Values the workflow keeps while it runs, such as a running total. |
| **Functions** | Reusable groups of steps with their own inputs and outputs. Use **Make global** to share a function with other workflows. |
| **Triggers** | Inputs, the schedule, and what else starts this workflow. |
| **Files** | Files stored with the workflow, such as a logo or a fixed template file. |

### Toolbar

- **Auto Layout** tidies the canvas.
- **Checkpoint** saves a named point in the workflow's history.
- **History** lists published versions and checkpoints. **Restore to draft** loads one back into the editor.
- **Discard draft** throws away changes you haven't published.
- **Test** publishes your current changes, without turning the workflow on, then starts a run and opens the test drawer with its steps and logs.
- **Publish** makes your changes the live version. **Publish & Enable** also turns the workflow on.

Changes are saved as a draft while you work, and other editors see them live. Runs use the published version, so publish (or test) to put your changes into effect.

> **Warning:** Because **Test** publishes, testing an enabled workflow puts your changes live straight away. Disable the workflow first if you don't want triggers to use your changes while you test.

## Triggers in detail

Open **Triggers** on the canvas.

- **Manual / external** lists the **Input parameters**. Click **Add parameter** to add one, and give it a name and type.
- **Run with custom inputs** starts a real run with values you type.
- **Schedule**: turn on **Enable schedule**, then enter when it should run and the **Timezone**, such as Europe/Berlin. The schedule uses the standard five-part cron format. For example, `0 7 * * 1-5` runs at 07:00 every weekday.
- **External callers** shows, read-only, which business rules and other workflows start this one.

To start a workflow from incoming email, open **Settings**, choose **Inbox**, and link a workflow to the inbox with **Create new workflow** or **Use existing workflow**.

## Watch runs

Each workflow has a **Runs** page listing every run with its status. Open a run to see each step, its inputs and outputs, the logs, and any error. **Replay on canvas** plays the run back step by step on the workflow itself.

The **Workflows** overview shows run health, recent failures, and approvals waiting for a decision.

## Approvals

A **Request Approval** step pauses the workflow until a person or group decides. The request appears on the **Approvals** page of the people it is assigned to, where they can **Approve** or **Reject** and add a comment. The workflow continues on the approved, rejected, or timeout path.

## Data access

A workflow reads and writes records through a view you choose on each step. That view's filter, hidden columns, and read-only columns apply, just as they do for people. The workflow acts with its own access in the organization, not with the permissions of whoever started it.

Writes from a workflow run the table's [business rules](/docs/business-rules), except bulk writes with **Bulk Upsert DataView**, which skip them for speed.

## Manage workflows

From a workflow's menu you can **Rename** it, **Change category** to keep the sidebar tidy, **Enable** or **Disable** it, or **Archive** it. Archiving removes it from the sidebar and stops its schedule.

> **Note:** Your plan includes a number of workflow runs per month and a limit on how many runs can go at the same time.

## When not to use a workflow

| You need | Use instead |
| --- | --- |
| Refuse a save when the data is wrong | A [validation](/docs/business-rules/validation) or [guard](/docs/business-rules/guard) |
| Fill a field as the record is saved | A [computation](/docs/business-rules/computation) |
| Write a record that must exist in the same transaction | A [side effect](/docs/business-rules/side-effect) |
| Tell another system about every change, with no logic | A [webhook](/docs/webhooks) |

## Plan a workflow

For each workflow, write down what starts it, the inputs, and the steps in the order you'd explain them to a colleague. Name the view each read or write uses, the document template for each PDF, and who approves, along with what happens on approval, rejection, and timeout.

  - [Workflow steps](/docs/workflows/nodes): Every step you can add, by category.
  - [Documents](/docs/documents): Design PDF templates that workflows fill in.
  - [Webhooks](/docs/webhooks): Send every change to another system.

---

Source: https://community.sapugo.app/docs/workflows
