> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/design-considerations-and-frameworks/frameworks/workflow-framework/creating-and-using-subworkflows.md).

# Creating and Using Subworkflows

## Introduction

The Workflow Framework enables users or systems to create and assign tasks based on user roles and to move those tasks through to completion depending on identified rules. This workflow functionality can be incorporated with other LogicNets frameworks, and it can also be used with subworkflows.

Within a workflow itself you can start up other workflows – subworkflows – using the 'Start Workflow' function. Using the 'Register Subworkflow' and 'Unregister subworkflow' functions you can register/unregister these workflows as subworkflows to your main workflow.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-2b4380fc7c33bcfd24000ac49e371a9552606874%2Feb160f6a-2f4f-4aca-8790-1d23c5e4a1fe.png?alt=media)

By modeling a 'Wait' task after starting and registering the subworkflows, the 'Wait' task waits until all subworkflows have been finished. The system suspends the main workflow until all subworkflows are finished.

## How to Model a Subworkflow

The example project located at the end of this topic demonstrates the steps discussed in this section, and it contains a main workflow and two subworkflows as shown in the picture above. Download the file and import it into your Designer.

In your workflow you assign a post-processing logicnet to your task in the main workflow. In the example project, 'workflow\_T' is the main workflow and you assign a postprocess logicnet called 'post\_process\_T1' to Task T1.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-a69b68146776ee677f29aca3a49c0eec06c8f5d9%2Ff8a4d8db-5bf9-4dd9-a3bc-12c9094f792e.png?alt=media)

The system then calls 'post\_process\_T1' each time a user exits task T1. In node 30, the system checks to see if the user exited task T1 by pressing the 'Next' button. If so, the system starts new instances of workflows C and D, which happens in nodes 40 and 60.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-dd0244b43605380b67d57a5a9086a55b0593c547%2F7e13910b-d5c4-41a0-88b6-a7cebc08cd2b.png?alt=media)

The system stores the instance IDs of the started workflows in the data objects 'id\_of\_sub\_workflow\_C' and 'id\_of\_sub\_workflow\_D'. In node 50 and 70, the system uses these IDs to register the workflows as subworkflows of the main workflow. To register a subworkflow you drag a 'Register Subworkflow' node from the nodes toolbox into your logicnet. In the parameters tab you can then specify the instance ID of the main workflow and the subworkflow that you want to register to the main workflow.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-60c7a5d17bedf9d189a956f2b1ea3779ed71de5e%2Ffd4a2663-6c6c-4d35-b7db-0bc7b3a9d1e7.png?alt=media)

Then add a wait task to the main workflow, right after task T1. To add a wait task, open the nodes toolbox and drag a 'wait task' node to the output of T1.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-6cd78da5c7a77bdf0351983d890e15333bf38e38%2Fa511c003-f916-43aa-85b3-c65bc6954b2b.png?alt=media)

Connect the output 'Continue' to task T2 and your workflow will wait at this task until the subworkflows are finished. Once the subworkflows are finished, the system continues the main workflow at task T2. Note: You should also remove the 'default' link when this one is connected.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-ba3d20fd88725e9031c2a1430ccc1446599aab3a%2F9cda6045-cd87-4e68-b4b3-4b9ccba8da70.png?alt=media)

## Example Project

Download the [Subworkflow Example Project](/release-9/example-gallery/example-applications/subworkflow-example-project.md) in conjunction with the information above to see how a subworkflow works.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/design-considerations-and-frameworks/frameworks/workflow-framework/creating-and-using-subworkflows.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
