Skip to main content

Node - Subprocess


The Subprocess node allows you to modularize and reuse business logic across multiple workflows. This is particularly useful when different triggers lead to the same sequence of actions or when processing a large number of records.

When to Use a Subprocess Node

1. Reuse Common Logic Across Different Triggers

For example, in an expense approval scenario, the approval process may be triggered either when a new record is created or when a user manually clicks a button after saving a draft. Although the triggering methods differ, the approval flow remains the same. By placing the approval logic in a subprocess, you can invoke it uniformly from both entry points—ensuring consistency and simplifying maintenance.

2. Processing More Than 100 Records in Bulk

When your workflow needs to process over 100 worksheet records in one batch, subprocesses can help. A single subprocess can handle up to 1 million worksheet records efficiently.

3. Conditional Branching When Processing Batch Data

Suppose you fetch 50 data entries from an external source. Some of these entries already exist in the worksheet and should be updated, while others do not exist and need to be added. In such cases, you can't simply use the "Update Record" node in batch mode. Instead, you can pass all records to a subprocess, where it first checks for record existence and then proceeds to either update or insert accordingly.

You can pass a single record or multiple records (rows of data) into a subprocess. Invoking a subprocess does not count toward the organization's workflow execution quota.

Example

Example 1: Reusing a Workflow as a Subprocess

In scenarios where the same approval workflow needs to be triggered from different sources—such as when a record is created or when a button is clicked—you can modularize the shared logic as a subprocess.

  1. Add a “Subprocess” node after the trigger node

  • A. Select which record data (from a node object) to pass into the subprocess.

  • B. After clicking the "Save" button, a new subprocess will be generated automatically.

  • C. Workflow parameters: You can pass values to the subprocess via workflow parameters for use during execution. Learn more about workflow parameters

  • D. If you check "After the subprocess is completed, start the next node", the next node will only execute after the subprocess finishes. If unchecked, both the subprocess and subsequent nodes in the main workflow will execute in parallel. The subprocess result will not affect the current workflow.

  • E. Pass the trigger: If "Set the trigger of the subprocess to be the trigger of this process" is checked, the subprocess will inherit the trigger identity. Otherwise, the subprocess will be triggered by the system workflow engine.

  1. Open the Generated Subprocess

  2. Configure the Subprocess

    Design your approval logic within the subprocess. Once configured, publish the workflow.

  3. Reference the Subprocess from a Button-Triggered Workflow

    In workflows triggered by a custom button, you can directly add a subprocess node and select an existing subprocess to reuse.

Tips

  • When selecting a subprocess, only workflows of type "subprocess" are available. Workflows triggered by worksheet events, date fields, schedule timers, Webhooks, or buttons cannot be selected.

  • A subprocess cannot be created independently. It must be created and used within a main workflow.

  • Workflow execution count: In this example, one execution of the main workflow and one execution of the subprocess will consume two workflow runs in total.

Example 2: Batch Data Processing

Suppose you need to periodically clean up records in an intermediate worksheet. You retrieve the records and attempt to delete them. However, if the number of records exceeds 1,000, the "Query and Bulk Delete" node cannot complete the task (limit: 1,000 records).

In this case, you can pass the records into a subprocess to delete them one by one, as shown below:

1. Select the Data Object

Choose the node from which to pass data into the subprocess. In this example, we select the "Get Multiple Data" node.

2. Maximum Data Limit

If the data source is a worksheet, you’ll see this configuration option.

  • When "Det all records from worksheet" is checked, up to 1 million records can be retrieved.
  • You can also define a custom limit; the default is 50,000 records.
  • If the data source is not a worksheet (e.g., array data from a code block, call PBP, or send API request node), up to 10,000 records can be processed.

3. Execution Mode for Multiple Records

  • Parallel Execution:
    Each record is processed independently and simultaneously. This is the recommended mode for this example.

  • Sequential Execution (Stop on Error):
    Records are processed one by one. If a subprocess fails for any record, subsequent subprocesses will not be triggered.

  • Sequential Execution (Skip on Error):
    If a subprocess fails for a record, it will be skipped and the system will proceed to the next record.

4. Handling Errors in the Subprocess

  • If "After the subprocess is completed, start the next node" is not checked, the outcome of the subprocess will not affect the rest of the main workflow.

  • If it is checked, and the subprocess is set to run in parallel or sequential (stop on error) mode:

    • Any error encountered in a subprocess will cause the main workflow to stop, and all nodes after the subprocess will be skipped.

5. Workflow Execution Count

For example, if the main workflow passes 500 records into the subprocess:

  • Each record will trigger one subprocess execution

  • If the subprocess updates the task status for each record, the total execution count will be:

    1 main workflow + 500 subprocesses = 501 executions