# Training Example: Create a New Workflow

Use this example to teach "how to make a new workflow".
It is simple. It has **3 steps** and **3 transitions**.
Everyone understands it: a document is submitted, a manager checks it, then it is approved.

---

## The Idea (say this first)

- A **Workflow** = the whole process.
- A **Step** = one stage of the process (like "Manager Review").
- A **Transition** = the movement from one step to the next. It also says **who** does the work and **what is required** (comment / file).

Picture:

```
[1. Submitted]  --Submit for Review-->  [2. Manager Review]  --Approve-->  [3. Approved ✅]
                                              |
                                              --Return for Correction-->  back to [1. Submitted]
```

---

## Example: "Document Approval Process"

### The 3 Steps

| Order | Step Name       |
|-------|-----------------|
| 1     | Submitted       |
| 2     | Manager Review  |
| 3     | Approved        |

### The 3 Transitions

| # | Transition Name        | From Step       | To Step        | Assign To      | Require Comment | Is End |
|---|------------------------|-----------------|----------------|----------------|-----------------|--------|
| 1 | Submit for Review      | Submitted       | Manager Review | **Admin** role | ✅ Yes          | No     |
| 2 | Approve                | Manager Review  | Approved       | **Admin** role | ✅ Yes          | ✅ YES |
| 3 | Return for Correction  | Manager Review  | Submitted      | **Admin** role | ✅ Yes          | No     |

> **Why assign everything to the "Admin" role?**
> So that YOU (logged in as `tech@switch.sc`, which has the Admin role) can see and complete every task during the demo.
> In real life you would assign each step to different people (e.g. Staff → Manager → Director).

> Transition #3 ("Return for Correction") is **optional**. Add it to show how a document can be sent back for changes. If you want to keep the demo very short, skip it.

---

## How to Build It — Click by Click

Login as **`tech@switch.sc`** first.

### Part 1 — Create the workflow
1. Go to **Workflow** → click **Create Workflow**.
2. **Name:** `Document Approval Process`
3. **Description:** `Simple example: submit, review, approve.`
4. Click **Save**.
5. ✅ The app takes you to the **Add Steps** page.

### Part 2 — Add the 3 steps
Do this 3 times (once for each step):
1. **Name:** type the step name (`Submitted`, then `Manager Review`, then `Approved`).
2. **Order:** leave empty (it fills 1, 2, 3 automatically) — or type the number.
3. Click **Save / Add Step**.
4. ✅ Each step appears in the list below.

When all 3 steps are added, go to **Transitions** (Add Transitions).

### Part 3 — Add the transitions
For **each** transition in the table above:
1. **Name:** type the transition name.
2. **From step:** choose the "From Step" from the table.
3. **To step:** choose the "To Step" from the table.
4. **Role(s):** choose **Admin**. (You must pick at least one role OR one user.)
5. Tick ☑ **Require comment**.
6. For transition **#2 (Approve)** only: also tick ☑ **Is end**.
7. Click **Add Transition**.
8. ✅ It appears in the transition list. Repeat for the next one.

After the **last** transition, click **Finish** (or **Save**).
✅ The workflow is now **Active** and ready to use.

---

## Test It (show it works)

1. Go to **Workflow** → **Create Document**.
2. **Title:** `Test Document 1`
3. **Workflow:** choose `Document Approval Process`.
4. Tick ☑ **Start immediately**.
5. Click **Submit**.
6. Go to **My Workflows** → you will see a task at step **Submitted**.
7. Open it → type a comment → choose **Submit for Review** → **Submit**.
8. The task moves to **Manager Review**. Open it again → comment → choose **Approve**.
9. ✅ The workflow is **completed**.

---

## Teaching Tips

- Build the steps **before** the transitions. Transitions need the steps to exist first.
- Every transition needs **at least one Role or User**, or it will not save.
- Only the **last** transition should have **Is end** ticked.
- If a task does not appear in **My Workflows**, check the transition is assigned to a role/user you have.
- Always tell users: **comment is required** — it is saved in the audit history.

---

## Quick Recap (one line)

**Workflow → add Steps → connect them with Transitions (who + comment/file) → tick "Is end" on the last one → Finish.**
</content>
