How to Create a 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 the child Workflow.

Hi there!

Since June 2018 Questetra’s website has been redesigned.
I would like to deliver more easily accessible and useful information.

* The product website is HERE (

Well, everyone, are your parent-child relationships going well?
Likewise, concerning the Workflow, there are people who want to build a good parent-child relationship on the Workflow.
I have occasionally heard of business processes like the following:

  • Certain business issues (parent issues) that are composed of multiple child issues.
  • Even though the parent issue and the child issues progress asynchronously, the status of the child issues is related to the progress of the parent issue.

It seems hard to do, but it’s possible if you use Questetra.
I will explain how, based on a specific 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

The business scenario is…

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

Implementation in Questetra


The outline of the implementation is as follows.

  1. Carry out internal approval of the 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 flows.
  4. The Step in parent flow will advance when the child flows that started at #3 are all completed.

There are the following conditions to satisfy:

  • The number of child flows 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 the child App is performed by accessing a Message Start Event (HTTP) on the child flow App. At that time, the related contract info which has been entered in a Table-type Data Item in the parent App is passed over.

The starting up part is performed by the 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, The Workflow API uses the Process ID to confirm whether or not all processes have been completed.
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 Data Viewer authorization on the child flow App.
* The password for Basic Authentication is different from the normal login password. (You can check yours in Account Settings.)


I believe that there are many cases where parent-child Workflows can be used.
Although most of these cases might be one on one, there may be cases like the use case in this article, which involve starting up an unspecified number of child flows. For example:

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

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

I hope that the sample flow I introduced in this article may be helpful to you for business of this kind.

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