Subflows (Subprocesses)

Introduction

In this guide, you'll learn how to use subflows (subprocesses) in Joget Workflow. Subflows allow you to call one process from another, enabling more complex workflows. This example will demonstrate how to set up a subflow where Workflow Process 1 calls Workflow Process 2 and passes variables between them.

How does it work?

  1. Workflow Process 1 contains a subflow called Workflow Process 2. It has three workflow variables: "status", "name", and "email". You will pass these three variables to Subflow Workflow Process 2.
  2. Workflow Process 2 receives the variables from Workflow Process 1 and has three corresponding variables: "sub_status", "sub_name", and "sub_email". The Subflow will return these three workflow variables to Workflow Process 1.
  3. When passing from parent to subflow process, maintain the sequence of the fields. The status and sub_status field Id should be in the first parameter row.

Subflow properties 

  • Id: Process to be called
  • Execution:
    • Synchronous: calls and creates the subflow instance and waits for the subflow process to finish before continuing to the next node in the workflow process.
    • Asynchronous: calls the subflow process and continues to the next node in the process, without waiting.
  • Subflow Parameters / Actual Parameters:

    The workflow variables in the subflow process will be mapped to the existing workflow variables in the current workflow process. The number of entries in Subflow Parameters and Actual Parameters should be identical.

    Id: Workflow Variable ID
    Mode:
    • In: Pass the value from the current workflow process's variable to the subflow process's variable only upon calling up the subflow process.
    • Out: Pass the value from the subflow workflow process's variable to the current workflow process's variable only upon completion of the subflow process.
    • In and Out: A combination of the above

Process flow example

In the screenshot of step 2 of the how does it work, the subflow process will be executed synchronously. Parameter are set to In and Out.

Let's walk through the entire process flow chronologically:

  1. Start of process Workflow Process 1.
  2. Activity 1 started.
  3. Activity 1 completed with "status" set to "a".
  4. Subflow process started. As the parameter is set to In and Out, the value "a" is now set to "sub_status" of the subflow process.
  5. Activity 3 started with "sub_status" initialized to "a".
  6. Activity 3 completed with "sub_status" set to "ab".
  7. Activity 4 started with "sub_status" initialized to "ab".
  8. Activity 4 completed with "sub_status" set to "abc".
  9. The subflow process has now come to an end. As the parameter is set to In and Out, the value "abc" is now returned to "status" of the parent process. Activity 2 started with "status" set to "abc".

Related documentation

Download sample app

Download the demo app for Subflows (Subprocesses) and ensure you are using Joget Workflow Enterprise v6 or later:
Created by Julieth Last modified by Aadrian on Dec 13, 2024