Parent-Child Workflows in K2 Studio (Intermediate)

This tutorial provides the step-by-step instructions for configuring a parent-child workflow using K2 Studio. To successfully work through this tutorial, you should be familiar with K2 terminology and workflow concepts. The steps in this tutorial are intermediate level. If you feel you need more basic instruction, begin with the Parent-Child Workflows (Basic) tutorial to get started with basic parent-child concepts.

Why use Parent-Child Workflows?

Parent-Child Workflows are ideal in situations where you have multiple tasks that are not dependent on each other. For example, you might start child workflows if you have a process that requires action from multiple departments, yet those actions are independent of the other departments. Another example would be if your process contains a number of system events (such as updating lists) that are not dependent on other steps in the process. Child workflows can run at the same time, or one after another. The parent workflow must have some sort of closure however, from the child workflow so that it can continue and complete.

For this tutorial, we are using a K2 Virtual Machine environment. The server and user names throughout this document reflect the VM environment. If you are building this tutorial within your own environment, your names and screen views will not be exactly the same as this document, but you can follow along and adapt the labels to meet your needs.

Workflow Design

In our parent-child vignette, we will create a new project in K2 Studio, then add two process items (the Parent Workflow and the Child Workflow). The Parent Workflow will consist of a single user task, which will demonstrate how the child workflows either start or don't start depending on the user decision selected. If the user selects to kick off the Child Workflows, the Parent Workflow will move on to an IPC (Inter-process Communication) event where K2 will determine how many Child Workflows to start (individually) based upon the number of members in the Role that we will create. We will configure the Parent Workflow to pause as the Child Workflows run. As each Child Workflow completes, it will revert back to the Parent Workflow where an email confirmation will be sent to the originator letting them know that the individual Child Workflow has completed. The originator will receive an email confirmation for each of the Child Workflows as they are completed. When all of the Child Workflows have completed, a final email will be sent to the originator to complete the parent-child workflow process.

The diagram below illustrates our parent-child concept using a flowchart. Notice that there are two columns, one for the Parent Workflow steps and one for the Child Workflow steps. What's important to notice here is that an individual Child Workflow (or sub-process) is started for each member of the Role.

Mapping out your workflow steps using a flowchart or similar diagram can help you to clearly visualize the events and steps necessary to accomplish your parent-child workflow goal.

There are six steps for completing this vignette. In Step 1, we will create the shell for our project by adding a Role (user group) in K2 Workspace. In K2 Studio, we will create a project and add two process items (the Parent Workflow and the Child Workflow) to the project. In Step 2, we will add one user task and one system task to the Parent Workflow. In Step 3, we will configure the destination rules and add the IPC event to the Parent Workflow. (The IPC event is the wizard we use to configure the Parent Workflow communication with the Child Workflow.) In Step 4, we will add a user task to the Child Workflow and configure its destination rules. Steps 5 and 6 complete our vignette as we deploy and test our project.

Duration
This tutorial should take approximately 30-45 minutes to complete.

We begin with Step 1, creating the Role and the workflow shell.