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

# Subflow in Task

When you create a task from a Flow that has a [Subflow](/pages/flow/flow-builder/component-subflow) component, MileApp automatically creates one or more **subtasks** that are connected to the **main task**. This guide explains how main tasks and subtasks appear in the Task list, how data is copied between them, and how to assign, move, edit, and delete them.

## Understanding Main Tasks and Subtasks

* **Main task** — the task created from a Flow that has a Subflow component inside it.
* **Subtask** — a task that is created automatically for every Subflow component on the main Flow.
* **Field mapping** — when the main task is created, the values on its fields are copied into the matching fields on each subtask, based on the mapping set up in the Flow Builder.

A main task can have one subtask or several, depending on how many Subflow components the Flow has. Subtasks always belong to a main task — they cannot stand on their own.

## How Subtasks Are Created

Once you create a task from a Flow that has Subflow components, MileApp runs these steps automatically:

1. The main task is created from the Flow, just like any other task.
2. For each Subflow component on that Flow, MileApp creates a separate subtask from the referenced child Flow.
3. Mapped fields are copied from the main task into the matching fields on every subtask.
4. Each subtask is linked back to the main task, so dispatchers can see which tasks belong together.
5. Subtasks inherit the main task's **assignee**, **hub**, **start time**, and **end time**. If the main task already has an assignee, the subtasks start with status **Ongoing**.

<Note>
  Subtasks cannot be assigned, moved, or scheduled on their own. These changes must be made on the main task, and they are applied to every subtask automatically.
</Note>

## Viewing Main Tasks and Subtasks in the Task List

### Desktop

In the Task list, a main task appears as an **expandable group** that shows the main task's Flow name together with the number of subtasks it has. Click the group header to expand it, and every subtask shows up as a row underneath. Click again to collapse the group.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/S-oPT4u1drbPai4U/images/flow/subflow-task-list-main.png?fit=max&auto=format&n=S-oPT4u1drbPai4U&q=85&s=59c0b2f524f61fe3c3b578b4211e6f43" alt="Task list main task and subtasks" width="600" data-path="images/flow/subflow-task-list-main.png" />

  <p><i>Task list showing main tasks as expandable groups with their subtasks indented below</i></p>
</div>

The expanded view shows:

1. **Flow column** — the Flow name of each task. The main task row shows the parent Flow; every subtask row shows its own Flow indented underneath with the `↳` marker.
2. **Task selection checkbox** — selecting the main task automatically includes all of its subtasks in any bulk operation.
3. **Status column** — the current status of each task (Unassigned, Ongoing, or Done).
4. **Action column** — row actions (view, edit, delete). The available actions depend on whether the row is a main task or a subtask.

### Mobile View

On mobile view, main tasks appear as **expandable card groups**. Tap the group header to expand or collapse the subtask cards. Each card shows the Flow name, status, and assignee.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/S-oPT4u1drbPai4U/images/flow/subflow-mobile-view.png?fit=max&auto=format&n=S-oPT4u1drbPai4U&q=85&s=f30a03f97c42f9af28aabc9036fc8cc8" alt="Task list mobile view" width="400" data-path="images/flow/subflow-mobile-view.png" />

  <p><i>Mobile view of the Task list rendering main tasks as expandable card groups</i></p>
</div>

## Bulk Operations

Selecting a main task in the Task list automatically includes every subtask in the operation. Bulk operations are accessed through the **Action** button above the list.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/S-oPT4u1drbPai4U/images/flow/subflow-bulk-actions.png?fit=max&auto=format&n=S-oPT4u1drbPai4U&q=85&s=e8e27abb03ec41e29359250f44c40b3e" alt="Bulk actions menu" width="600" data-path="images/flow/subflow-bulk-actions.png" />

  <p><i>Selecting a main task and opening the Action menu — both rows are highlighted</i></p>
</div>

1. **Action button** — opens the bulk Action menu at the top-right of the Task list. The button becomes active once at least one task is selected.
2. **Action menu** — the list of bulk operations you can run on the selected tasks.

Available bulk actions:

* **Edit Time** — change the **Start time** and **End time** on all selected tasks at once.
* **Assign** — assign a user to the selected tasks.
* **Unassign** — remove the assignee from the selected tasks.
* **Move** — move the selected tasks to another hub.
* **Delete** — delete the selected tasks.
* **Show on table** — toggle which columns are visible in the Task list (this only changes the view; it does not modify any task).

When the selected row is a main task, the action runs on the main task first and is then applied to all of its subtasks. See the sections below for the rules that apply to each action.

## Viewing Main Task Details

Opening a main task shows the main task data plus a summary of its subtasks.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/S-oPT4u1drbPai4U/images/flow/subflow-main-detail.png?fit=max&auto=format&n=S-oPT4u1drbPai4U&q=85&s=f433423a2d0c83bac0fd1eca16492507" alt="Main task detail" width="600" data-path="images/flow/subflow-main-detail.png" />

  <p><i>Main task detail dialog with its field data, status, and the list of subtasks underneath</i></p>
</div>

1. **Field data area** — the values captured on the main task (Title, Content, Label, and any other fields from the main Flow).
2. **Status badge** — the main task's own status (Unassigned, Ongoing, or Done).
3. **Subtasks list** — every subtask connected to this main task, shown inside the **Subtasks** tab of the More Details section. Click a subtask name to jump to its own detail dialog.

Other tabs in the More Details section (**Field**, **History**, **Other**) work the same way as on a regular task. The Creation, Assignment, and Completion blocks above the More Details panel summarize who created, assigned, or completed the main task.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/S-oPT4u1drbPai4U/images/flow/subflow-subtask-detail.png?fit=max&auto=format&n=S-oPT4u1drbPai4U&q=85&s=9be3c9a07bb05dc8a9970a71b3aab193" alt="Subtask detail" width="600" data-path="images/flow/subflow-subtask-detail.png" />

  <p><i>Subtask detail dialog opened from a main task's subtask list</i></p>
</div>

1. **Master Task link** — the name of the main task this subtask belongs to. Click it to jump back to the main task's detail.
2. **Field data area** — the values captured on the subtask. Fields mapped from the main task through Subflow field mapping are pre-filled here.
3. **Status badge** — the subtask's own status (Unassigned, Ongoing, or Done).

## Assigning Main Tasks

When you assign a user to a main task, the assignment is applied to every subtask too. You cannot assign a subtask independently — the assignee field on a subtask is disabled in the Task list.

If the assignee on the main task is changed later, the new assignee replaces the previous assignee on every subtask.

<Warning>
  Reassigning a main task is blocked once any of its subtasks has reached status **Done**. To change the assignee, do it before any subtask is finished.
</Warning>

## Moving Main Tasks

Moving a main task to a different hub also moves every subtask to the same hub. The move operation can only be performed when:

* The main task is **Unassigned**, and
* Every subtask is also **Unassigned**.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/S-oPT4u1drbPai4U/images/flow/subflow-move-dialog.png?fit=max&auto=format&n=S-oPT4u1drbPai4U&q=85&s=6063c7623d71968c7966b958cc6dffe4" alt="Move task dialog" width="600" data-path="images/flow/subflow-move-dialog.png" />

  <p><i>Move Task Confirmation listing the main task with all of its subtasks before the move runs</i></p>
</div>

1. **Tasks to move** — the main task and every subtask that will be moved together. Review the list to make sure no other task is accidentally included.
2. **Total tasks to move** — a summary count showing how many main tasks (Total task with subflow) and subtasks (Total subflow) will be moved when you click **Continue**.

If the main task or any subtask is already **Ongoing** or **Done**, the move is rejected.

## Editing Main Tasks and Subtasks

### Editing a main task

The main task is fully editable in the Task list — title, custom fields, assignment, scheduling, and other Flow data can all be changed.

Some changes on the main task are applied to every subtask automatically:

* **Assignee**
* **Start time**
* **End time**

Other fields (such as customer name, order number, or other custom data) are saved only on the main task and do not affect the subtasks.

### Editing a subtask

A subtask's assignee, start time, end time, and hub cannot be changed on the subtask itself — these always come from the main task. The subtask's own data fields are filled in by the field worker when they complete the task.

<Note>
  Action buttons like Assign, Unassign, Move, and Delete are disabled on subtask rows in the Task list. Use the main task to perform these actions instead.
</Note>

## Deleting Main Tasks and Subtasks

### Deleting a main task

Deleting a main task also deletes every subtask connected to it. Before the deletion runs, the Task list shows a confirmation dialog that lists every task that will be removed, so you can review what's affected before confirming.

<div align="center">
  <img src="https://mintcdn.com/mileapp-c1584fbc/S-oPT4u1drbPai4U/images/flow/subflow-delete-confirm.png?fit=max&auto=format&n=S-oPT4u1drbPai4U&q=85&s=31ef8e0e2fbc2c00f1097b99092fb713" alt="Delete confirmation" width="600" data-path="images/flow/subflow-delete-confirm.png" />

  <p><i>Confirmation dialog listing the main task and its subtasks that will be deleted together</i></p>
</div>

<Warning>
  Deletion is blocked if any subtask has already reached status **Done**. Completed subtasks must be preserved as part of the task history, so the main task cannot be deleted while any of its subtasks is Done.
</Warning>

### Deleting a subtask on its own

* A subtask that belongs to a **Required** Subflow cannot be deleted on its own — it can only be removed together with its main task.
* A subtask from a non-Required Subflow can be deleted individually, as long as it is not already in status **Done**.

## Frequently Asked Questions

**Q: Can I assign a different user to a subtask?**

A: No. A subtask always shares the assignee with its main task. To change who works on the whole workflow, change the assignee on the main task — every subtask is updated automatically.

**Q: Why are some action buttons disabled on a subtask row?**

A: Subtasks cannot be assigned, moved, scheduled, or (when they belong to a Required Subflow) deleted on their own. These actions are only valid on the main task, so they are disabled on subtask rows.

**Q: What happens to the main task when I complete a subtask?**

A: The subtask's status changes to **Done**, but the main task stays in its current status until you mark it Done yourself. If the Subflow is set as Required, the main task cannot be marked Done until every Required subtask is also Done.

**Q: Can a subtask reference another Subflow inside it?**

A: No. A Flow that already has a Subflow component cannot be picked as another Subflow's target — Subflows are limited to one level deep.

**Q: I marked a subtask Done by accident. Can I delete it to start over?**

A: No. Once a subtask is **Done**, it can no longer be deleted, and the main task also cannot be deleted while any of its subtasks is Done. Completed subtasks are kept as part of the task history.

**Q: Can I move only one subtask to a different hub?**

A: No. Subtasks always move together with their main task. To move the whole workflow to another hub, the main task and every subtask must still be **Unassigned**, and the move is performed on the main task.

## Related

* [Component: Subflow](/pages/flow/flow-builder/component-subflow)
* [Subpage in Task](/pages/task/creating-task/subpage-in-task)
* [Creating a Task](/pages/task/creating-task/manual-task-input/manual-task-input)
* [Flow Components Overview](/pages/flow/flow-builder/introduction)
