> For the complete documentation index, see [llms.txt](https://docs.work-relay.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.work-relay.com/automations/best-practices-screensteps/how-to-complete-a-parent-step-from-a-subprocess.md).

# How to complete a parent step from a subprocess

Subprocesses are a great way to embed reusable processes inside your primary process. The most common design pattern is to use a system step in the parent process as a container for the subprocess. See below for best practices showing how to set up parent container steps and to proceed the parent from the subprocess:

{% stepper %}
{% step %}

## Set processing frequency to Never on parent step

If a step has no other purpose than being a container for a subprocess, it does not need to be evaluated at a regular intervals. We will instead use the subprocess to advance the parent step once it is complete.

![](/files/b524de21ccd8c684c04b46ffc5ead6fb329123b2)
{% endstep %}

{% step %}

## Add the Start Subflow action to the container step

Set up the following parameters:

![](/files/05b796336823b0ce852850957945bc4ea716ea5f)

* Make sure Lock Parent is set so parent waits for subprocess to complete.
* If you want to use variables from the parent in the subprocess, check Inherit Variables.
* If you want to store the ID of the subprocess instance as a variable, supply a value in Variable Name.
  {% endstep %}

{% step %}

## Add a Call Apex action in the subprocess

In the subprocess, add a Call Apex action on the connector(s) going to the End step:

![](/files/76cfd19a62dc91467470ef5dd7f709d61847c8b9)
{% endstep %}

{% step %}

## Configure the Call Apex action

Set up the following parameters in the Call Apex action dialog:

![](/files/fd388223234289d6b35c3f77dae3c96ad68fbf9d)

* Keep Work Relay API checkbox field checked.
* Select WorkflowProceedService from API Class Name dropdown.
* Select completeParentStep from API Method Name dropdown.
* Using Advanced mode, select the ID from the **$Cursor** context object and insert into the `cursorId` parameter.
* Type "Proceed" under operation (other options include Approve/Reject for decision steps).
* The only time you need to supply a value (true) on ignoreLockException is if there is more than one subflow on the parent step. In this case, each subflow with a connector to the End step should have the same Call Apex action with a value of "true" for this parameter.
  {% endstep %}
  {% endstepper %}
