# Sub-Workflow

#### Create the sub-workflow <a href="#create-the-sub-workflow" id="create-the-sub-workflow"></a>

1. Create a new workflow.
2. **Optional**: configure which workflows can call the sub-workflow:
   1. Select the **Options** ![Options menu](https://docs.n8n.io/_images/common-icons/three-dot-options-menu.png) menu > **Settings**. Appizap Workflow Builder opens the **Workflow settings** modal.
   2. Change the **This workflow can be called by** setting. Refer to [Workflow settings](https://docs.n8n.io/workflows/settings/) for more information on configuring your workflows.
3. Add the **Execute Workflow Trigger** node.
4. Add other nodes as needed to build your sub-workflow functionality.
5. Save the sub-workflow.

{% hint style="info" %}
If any mistakes are present within the sub-workflow, it will prevent the parent workflow from being triggered.
{% endhint %}

**Load data into sub-workflow before building**

1. Create the sub-workflow and add the **Execute Workflow Trigger**.
2. In the sub-workflow settings, set **Save successful production executions** to **Save**.
3. Skip ahead to setting up the parent workflow, and run it.
4. Follow the steps to [load data from previous executions](https://docs.n8n.io/workflows/executions/debug/). You can now pin example data in the trigger node, enabling you to work with real data while configuring the rest of the workflow.

#### Call the sub-workflow <a href="#call-the-sub-workflow" id="call-the-sub-workflow"></a>

1. Open the workflow where you want to call the sub-workflow.
2. Add the **Execute Workflow** node.
3. Set the sub-workflow to be called in the **Execute Workflow** node. This can be done by choosing the workflow ID, loading a local file, adding JSON as a parameter, or targeting a workflow URL. *`Your sub-workflow's ID is the alphanumeric string at the end of its URL.`*
4. Save your workflow.

When your workflow executes, it will send data to the sub-workflow, and run it.

### How data passes between workflows <a href="#how-data-passes-between-workflows" id="how-data-passes-between-workflows"></a>

For example, In **Workflow A**, there is an **Execute Workflow** node that triggers **Workflow B**.

1. The Execute Workflow node sends data to the Execute Workflow trigger node in **Workflow B**.
2. The final node in **Workflow B** sends data to the Execute Workflow node in **Workflow A**.
