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

# Subflow

> Create a linked subtask of another flow, filled from this task's answers.

**Subflow** makes a task create a **subtask** of another flow. When a task is created, one subtask is created for each Subflow component, with its fields filled from the main task. The field worker opens the subtask from the main task, and the main task can wait until the subtask is done.

The two flows stay separate: editing the subtask's flow does not change this one. In the task list the main task is marked as the **parent** and the new one as its **subtask**. See [Subflow in a Task](https://docsv4.mile.app/pages/activities/task/subflow-in-task.md).

> [!NOTE]
>
> Subflow can only go on field app pages, not on the Initial page.

**Use cases**

* **Hand-off to another team**: a return pickup or an approval done by someone else.
* **Quality control**: a separate, trackable inspection step.
* **Separate records**: keep related information in its own task.

## Properties

![Subflow properties](https://mintcdn.com/mileappv4/Zv-R0yz4NrNyQHzp/images/v4/workflow/components/subflow.png?fit=max\&auto=format\&n=Zv-R0yz4NrNyQHzp\&q=85\&s=5eb2fe97e77fca3e8f0462932ccbe8d1)

1. **Required**: when on, the main task cannot be finished until the subtask is done.
2. **Select flow**: the flow the subtask uses. It needs an Initial page with components on it.
3. **Field mappings**: one row per component on the chosen flow's Initial page.
4. **Select component**: for each row, the component of *this* flow whose answer fills it. Every row must be filled before you can save.

Subflow has no Visible switch: the subflow card is always shown on its page. To hide it, remove the component.

## Choosing the flow

![Select flow](https://mintcdn.com/mileappv4/Zv-R0yz4NrNyQHzp/images/v4/workflow/components/subflow-picker.png?fit=max\&auto=format\&n=Zv-R0yz4NrNyQHzp\&q=85\&s=5e8cb625362cf371ba5b2cc62233b91a)

The list shows every flow, but blocks two kinds:

* **Current flow**: a flow cannot point to itself.
* **Contains nested subflows (not supported)**: a flow that has a Subflow of its own.

## Field mappings

Only components on the main flow's **Initial page** can be mapped, and View components are not listed. A component used in a mapping is made **Required** automatically, because the subtask cannot be created without it.

Each row only offers components of a compatible type:

| Subtask field | Can be filled from |
| - | - |
| Input: Text | Input of any type except Number, or a Select |
| Input: Number | Input: Number |
| Input: Date | Input: Date |
| Input: Date and time | Input: Date, or Date and time |
| Input: Time | Input: Time |
| Input: Phone number | Input: Phone number |
| Input: Coordinate | Input: Coordinate |
| Input: Link | Input: Link |
| Input: Currency | Input: Currency |
| Input: Address | Input: Text or Address |
| Select | Select |
| Photo, Signature | Photo or Signature |
| Bill | Bill |
| List | List |
| Timer | Timer |
| Voice | Voice |
| Capture | Capture |

## How to set it up

**1. Add it to a field app page**

Open a field app page, click **Add component** and choose **Subflow**. Write a **Title**, such as *Return Pickup*.

**2. Pick the flow**

Open **Select flow** and pick the one the subtask uses.

**3. Map every field**

In **Field mappings**, pick a component for each row.

**4. Decide if it must be done**

Turn on **Required** if the main task must wait for the subtask.

## On the field app

The page shows a card with the subflow's title and *Flow: {name}*. Tapping it opens the subtask, a real separate task, with the mapped fields already filled. With **Required** on, the main task cannot be finished until the subtask is done. See the preview on the [Photo](https://docsv4.mile.app/pages/workflow/flow/components/photo.md) page.

## Rules

* A Subflow cannot be added to, or moved to, the Initial page.
* A flow that contains a Subflow cannot be picked as a subtask.
* A flow cannot point to itself.
* Every listed field must be mapped before saving.
* Mappings only offer compatible types.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.