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

# Start embedded subprocess

> The Start Embedded Subprocess node initiates subprocesses within a parent process, allowing for encapsulated functionality and enhanced process management.

## Overview

The Start Embedded Subprocess node enables the initiation of subprocesses within a parent process, offering a range of features and options for enhanced functionality.

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release40/start_embedded_subprocess.png)
</Frame>

## Usage Considerations

### Data Management

Embedded subprocesses offer advantages such as:

* Segregated sections from a subprocess can be utilized without rendering them over the parent process.
* Data is stored within the parent process instance, eliminating the need for data transfer.
* Embedded subprocesses are visible in the navigation view.

### Runtime Considerations

**Important** runtime considerations for embedded subprocesses include:

* The **child process** must have only **one swimlane**.
* Runtime swimlane permissions are inherited from the parent.
* Certain boundary events are supported on Start Embedded Subprocess node, except for Timer events (currently not implemented).

<Warning>
  Embedded subprocesses cannot support multiple swimlanes in the actual implementation.
</Warning>

## Example

Let's explore this scenario: Imagine you're creating a process that involves a series of steps, each akin to a sequential movement of a stepper. Now, among these steps, rather than configuring one step from scratch, you can integrate a pre-existing process, treating it as a self-contained unit within the overarching process.

### Step 1: Design the Embedded Subprocess

<Steps>
  <Step title="Access FlowX.AI Designer">
    Log in to the FlowX.AI Designer where you create and manage process flows.
  </Step>

  <Step title="Create a New Process">
    Start by creating a new process or selecting an existing process where you want to embed the subprocess.
  </Step>

  <Step title="Navigation Areas">
    Design your navigation areas to match your needs.

    <Frame>
      ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release40/embedded_example_copy.png)
    </Frame>

    <Check>
      Make sure you allocated all your user tasks into the navigation area accordingly.
    </Check>
  </Step>

  <Step title="Design Subprocess">
    Within the selected process, design the subprocess by adding necessary tasks, events and so on. Ensure that the subprocess is contained within **a single swimlane**.
  </Step>
</Steps>

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release40/subprocess_to_embed.png)
</Frame>

<Warning>
  To initiate a process with an embedded subprocess, designate the root Navigation Area of the subprocess as an inheritance placeholder **Parent Process Area** label in the **Navigation Areas**.
  Ensure that the navigation hierarchy within the Parent Process Area can be displayed beneath the parent navigation area within the main process interface.

  <Frame>
    ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release40/embed_sbprc.gif)
  </Frame>

  <Check>
    Make sure you allocated all your user tasks into the navigation area accordingly.
  </Check>
</Warning>

### Step 2: Configure Start Embedded Subprocess Node

<Steps>
  <Step title="Add Start Embedded Subprocess Node">
    Within the parent process, add a **Start Embedded Subprocess Node** from the node palette to initiate the embedded subprocess.

    <Frame>
      <img src="https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release40/subprocess_nodes.png" alt="Subprocess Nodes" style={{ maxHeight: '600px' }} />
    </Frame>
  </Step>

  <Step title="Specify Subprocess">
    Configure the node to specify the embedded subprocess that it will initiate. This typically involves selecting the subprocess from the available subprocesses in your process repository.

    <Frame>
      ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release40/config_embed_node.png)
    </Frame>
  </Step>
</Steps>

### Step 3: Customize Subprocess Behavior

<Info>
  [**Alternative flows**](../../process/navigation-areas#alternative-flows) configured in the **main process** will also be applied to **embedded subprocesses** if they share the same name.
</Info>

<Steps>
  <Step title="Customize Data Handling">
    Within the subprocess, handle data as needed. Remember that data is stored within the parent process instance when using embedded subprocesses.
  </Step>

  <Step title="Implement Boundary Events">
    Implement boundary events within the subprocess if specific actions need to be triggered based on certain conditions.
  </Step>
</Steps>

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release40/subprocess_instance.gif)
</Frame>

### Step 4: Test Integration

<Steps>
  <Step title="Test Functionality">
    Test the integration of the embedded subprocess within the parent process. Ensure that the subprocess initiates correctly and interacts with the parent process as expected.
  </Step>

  <Step title="Verify Data Flow">
    Verify that data flows correctly between the parent process and the embedded subprocess. Check if any results produced by the subprocess are correctly captured by the parent process.
  </Step>
</Steps>

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release40/final_embed_result.gif)
</Frame>

For further details on other ways of configuring and utilizing subprocesses, refer to the following resources:

<CardGroup>
  <Card title="Subprocess Configuration" href="../../process/subprocess" icon="link" />

  <Card title="Start Subprocess action" href="../../actions/start-subprocess-action" icon="link" />

  <Card title="Process design principles" href="../../process/design-principles" icon="compass">
    Subprocess lifecycle, Call Activity vs. User Task action, async constraints.
  </Card>
</CardGroup>
