> ## Documentation Index
> Fetch the complete documentation index at: https://staging.docs.flowsign.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Building a workflow

> Turn a document you send often into a template with roles, fields, reminders and expiry.

A **template** is a reusable package definition. You upload the documents and place the fields once; every package created from the template inherits them. Instead of naming specific people, a template defines **roles** (for example *Employee* and *Manager*). When you send from the template you fill in who plays each role.

<Frame caption="The template builder, where a workflow is assembled.">
  <img src="https://mintcdn.com/doc-a97e5290/CtLjU_PfJfA-w8X1/images/guides/building-a-workflow.png?fit=max&auto=format&n=CtLjU_PfJfA-w8X1&q=85&s=9d7e43134843603562bc6290553cfd20" alt="The template builder showing a template's roles and documents" width="2880" height="1800" data-path="images/guides/building-a-workflow.png" />
</Frame>

Use a template when:

* the same document goes out many times with different recipients,
* several people must act in a fixed order,
* you want to send from the [API](/developers) or an automation.

<Steps>
  <Step title="Create the template">
    Go to **Templates** and create a new template. The form is organised into sections: **Template Details**, **Documents**, **Roles**, **Merge Fields**, **Email Customisation**, **Reminders & Expiration**, **Template Locking** and **PowerForm**.

    Give the template a name, an optional description and tags, then upload the base PDF in **Documents**.
  </Step>

  <Step title="Define roles">
    In **Roles**, add one role per participant. Each role has a name and an action type:

    | Action type | What the person does                             |
    | ----------- | ------------------------------------------------ |
    | Signer      | Completes the fields assigned to the role        |
    | Viewer      | Reads the package while it is out; has no fields |
    | CC          | Receives the finished copy by email only         |

    Drag roles to set their order. The section is called **Roles and signing order**, and its signing mode picker offers three modes:

    | Signing mode       | What it does                                            |
    | ------------------ | ------------------------------------------------------- |
    | Parallel signing   | Everyone signs at once, in any order                    |
    | Sequential signing | Roles sign one at a time, in role order                 |
    | Workflow           | Answers to questions decide the documents and who signs |

    Parallel and sequential signing need nothing more than the role cards. Workflow adds a canvas to the same section: see [Workflow signing](#workflow-signing) below.
  </Step>

  <Step title="Place fields">
    Open the template's fields editor and drag fields onto the pages. Assign each field to a role and mark it required where the signer must complete it. Available field types include Signature, Initial, Date, Name, Email, Company, Title, Text, Number, Checkbox, Radio and Dropdown.
  </Step>

  <Step title="Add merge fields (optional)">
    A merge field is a named value (for example `employee_name` or `start_date`) that you supply at send time. Each has a key, a label, an optional default value and a required flag. Values are interpolated into the template's name and email copy when a package is created from it.
  </Step>

  <Step title="Set email, reminders and expiry">
    * **Email Customisation**: the invitation subject and message used for packages sent from this template.
    * **Reminders & Expiration**: **Send reminder after** (days after sending), **Expire after** (days until the package expires unsigned) and **Warn before expiry** (days before expiry to warn recipients).
    * **Template Locking**: lock the documents, roles or fields so senders cannot change them when they send.
  </Step>

  <Step title="Activate and send">
    A template starts as `DRAFT`. Set it to `ACTIVE` when it is ready to use. To send, create a package from the template, fill in a name and email for each role, supply any merge field values, and send. The package copies the template's documents and fields, so later edits to the template do not affect packages already sent.
  </Step>
</Steps>

## Workflow signing

Parallel and sequential signing send the same documents to the same roles every time, and only the order changes. Choose **Workflow** when the package itself varies: when an answer decides which documents go out, or which role is brought in. A workflow can also write a value into a merge field, so the wording of a document changes with an answer.

### Opening the workflow builder

Set the signing mode to **Workflow** and a locked canvas appears under the role cards. Click it to open the **Workflow builder**: **Draw workflow** on an empty canvas, **Edit workflow** once there is something on it. The dialog has a **Build** and a **Preview** mode, a fullscreen toggle, and a **Show me how this works** button that walks you through whichever mode you are in.

### The blocks

The rail on the left has a **Blocks** tab and a **Roles** tab. The blocks are grouped:

| Block                 | What it does                                                           |
| --------------------- | ---------------------------------------------------------------------- |
| Default documents     | Documents that are always part of the package                          |
| Conditional documents | Documents that depend on an answer                                     |
| Question              | A yes/no or multiple choice question, or an open text or number answer |
| Role                  | Who receives and signs at that point in the flow                       |
| Variable              | Sets one of the template's merge fields to a value                     |
| Operator              | AND, OR and NOT, or a numeric comparison                               |

### Placing and wiring cards

Click a block to pick it up and then click the canvas to drop it, or drag it straight across. Press `Escape` to put it back. A block you have placed is a **card**.

Wire cards together by dragging from the dot on the edge of one card to the next. A question card has a connector for each of its answers, so dragging from one answer's dot sends that answer down its own path: wire it to a conditional documents card to say what that answer includes or drops. Connections that would not make sense are refused with a message saying why.

The toolbar on the canvas has undo and redo, copy and paste, **Tidy the layout** (which straightens the whole flow in one pass), toggles for showing conditions on cards, snapping to grid and shifting downstream cards when one is resized, plus zoom and **Fit to view**.

### Roles

The **Roles** tab in the rail edits the same roles as the template's **Roles** section, so a name changed in one place changes in the other. A role card on the canvas points at one of those roles. When the flow reaches it, that role is sent their link. Questions wired below it are theirs to answer before they sign, and roles wired below it wait for them to finish.

### Editing a card

Select a card and its settings open in the panel on the right. Documents and question cards split their settings across **General** and **Advanced** tabs. Deleting a card asks you to confirm first, and removes the lines wired to it.

### Fix problems before you save

When something is incomplete, the footer shows a count of things to fix. Click it to jump back to **Build** with the note on the canvas, and **Show me** frames the cards involved. While the template signs by a workflow, saving the template itself is blocked until the list is clear.

### Preview it

**Preview** runs the workflow against one set of answers. **Flow view** steps through choosing a scenario, the answers that scenario uses, and the resulting list of documents included and left out, with the path taken highlighted on the canvas. A legend explains the lines, and the canvas has its own zoom and fit controls.

**Signer view** tests one person's experience. Pick a role, pick a scenario to set the answers given before that signer's turn, then answer the real pre-signing questions that role is asked. It then lists the documents the workflow includes for that role.

<Note>
  Signer view stops at the document list. Reviewing and signing the documents happens on the real signing page, not in the preview.
</Note>

### Save

**Save workflow** closes the builder and keeps the canvas as you left it. Closing it another way with unsaved changes asks whether to discard them. The workflow is stored with the template, so finish the template's other sections and save the template to keep it.

<Tip>
  Templates are the recommended way to send from code. `POST /api/v1/templates/{templateId}` creates a package from a template with recipients mapped onto its roles; see the [developer quickstart](/developers).
</Tip>

## Troubleshooting

**A signer says they did not receive the email.** Ask them to check spam or junk. The package page shows whether their session has been sent and opened.

**A field is not showing for a signer.** Check which role the field is assigned to in the template. Only the recipient filling that role sees it.

**The template cannot be sent.** Make sure it has at least one document and one role, and that its status is `ACTIVE`.
