How to Create Good Parent-Child Workflow

How to Create Good Parent-Child Workflow
I will show you how to launch child Workflows from a parent Workflow, and advance the parent Workflow according to the situation in child Workflow.

Hi, there!

Since June 2018, Questetra’s website has been renewed.
I would like to deliver more readily and useful information.

* The product website is HERE (

Well, everyone, are your parent-child relationships going well?
Likewise, concerning the Workflow, there seem people who want to build a good parent-child relationship on the Workflow.
I sometimes heard of business issues such as

  • Certain business issue (parent issue) is configured with plural child issues.
  • Even though the parent issue and the child issues progress asynchronously, the situation of the child issues is also related to the progress of the parent issue.

It seems hard to do. But it’s okay if Questetra.
I will explain how, based on a specific use case.

  • The use case
  • Implementation in Questetra
    • Outline
    • Definition of Workflow App
      • Launching of child App
      • Confirmation on Child-flow completion
  • Afterword

The use case

As the business scenario, it is

  • The vendor sells a client a product consisting of parts of A, B, and C.
  • The vendor concludes sales agreement with the client upon sale.
  • Internal approval of a sales contract as an internal rule of the vendor is carried out after the contract of making all parts is completed.

Implementation in Questetra


The outline of implementation is as follows.

  1. Carry out internal approval of sales contract in the Workflow (parent flow)
  2. Carry out internal approval of the contract related to the sales contract in the Workflow (child flow)
  3. Register the related contract in the parent flow, then automatically Start the child flow Apps and execute the child flow.
  4. The Step in parent flow will advance at the time the child flow that Started at #3 are all completed.

There are the following conditions to satisfy.

  • The number of child flow/contents to be Started differs depending on the cases.
  • It is necessary to check whether all activated child flows have been completed.
We need to satisfy the above outline and conditions for the implementation.

Definition of Workflow App

Launching of child App

Launching of child App is performed by accessing Message Start Event (HTTP) on the child flow App. At that time, the Related contract info which has entered in Table-type data in the parent App is passed.

The starting up part is performed at Script Task.

<Interface of Message Start Event (HTTP) on child flow>

<Contents of Script Task “Start up” on child flow>

var parentNumber = engine.findDataByNumber("1");
var table = engine.findDataByNumber("0");
var childName = "";
var childNumber = "";
var uri = "https://****************";
var keyValue = "*******************";

for (var i=0 ; i < table.size(); i++){
  childName = table.get(i,0);
  childNumber = table.get(i,1);
    var response = httpClient.begin()
      .get( uri );
    engine.log("StatusCode:" + response.getStatusCode() + ":" + response.getResponseAsString() + "\n");
    if( response.getStatusCode() != 200 ){
      engine.log("Exception:send error:" + response.getStatusCode() + "\n");
Confirmation on Child-flow completion

Since the Process ID of the parent flow is linked to the child flow, it retrieves whether it is all completed by using the Workflow API.
Specifically, it uses /API /OR/ProcessInstance/list and performs the retrieval at the Script Task.
The criteria necessary for the retrieval is as follows.

<Criteria for retrieving related child flow>

  <process-model-info-id>●● App ID of child flow ●●</process-model-info-id>
      <data-definition-number>●● Data Item number in which Process ID of parent App is stored ●●</data-definition-number>
      <value>●● Process ID of parent flow ●●</value>

<Contents of Script Task for retrieval in related child flow>

var parentNumber = engine.findDataByNumber("1");
var uri = "https://*******************";
var userName = "";
var appPass = "**************************";
var appId = "22";
var finished = false;
var selects = new java.util.ArrayList();

var criteria = "<process-instance-criteria><process-model-info-id>";
criteria += appId;
criteria += "</process-model-info-id>";
criteria += "<states><state>STARTED</state></states>";
criteria += "<data><decimal><data-definition-number>4</data-definition-number><equals/>"
criteria += "<value>" + processInstance.getProcessInstanceId() + "</value></decimal></data>";
criteria += "</process-instance-criteria>";

  var response = httpClient.begin()
    .queryParam( "criteria", criteria )
    .get( uri );
  engine.log(" uri:" + uri + "\n criteria:" + criteria + "\n");
  responseJson = response.getResponseAsString();
  engine.log("StatusCode:" + response.getStatusCode() + "\n");
  if( response.getStatusCode() == 200 ){
    var jsonObj = JSON.parse( responseJson );
    engine.log("count:" + jsonObj.count + "\n");
    if (jsonObj.count == 0){
      finished = true;
    engine.log("Exception:send error\n");
if (finished){
  selects.add("All child contract completed");

* For the Basic authentication for accessing /API /OR/ProcessInstance/list, specify a User who has the authorization of data viewer on the child flow App.
* The password for password for Basic Authentication is something different from normal login password. (You can check yours in Account Setting.)


I believe that there are many cases where parent-child Workflow to be used.
Although the most of these cases might be one on one, there may be cases like the use case in this article, such as starting up an unspecified number of child flows. I suppose, for example

  • Sub-projects under a system development project
  • An event planning that consists of many small events

In these above cases, the progress of child flow possibly concerns with the progress of parent flow.

I hope that the sample flow I introduced in this article may be helpful for your businesses of these kinds.

Please try it by all means once. And if you have any questions, please do not hesitate to contact us.

%d bloggers like this: