How to get an aggregated result from a multi instance sub process


#1

I have a process In which a user is provided with a list of subtasks e.g. Todo list of a day. which is created from a collection. For each instance, the variables are saved at activity level.
E.g. :
subtask 1: complete
subtask 2: complete
subtask 3: incomplete
subtask 4: complete

I want to get an aggregated result from the subprocess. when any of the instance’s variable value is “incomplete”, the aggregated result should say that the result is “incomplete”.
Thanks in advance :slight_smile:

multiInstanceTest.bpmn (13.0 KB)


#2

Hi,

I am not sure if I understood you goal completely.
If you need to get all of the tasks which are “incomplete” (assuming that you have a variable which indicates it.)
You need to query for those tasks which have a process instance variable equal to “incomplete”.
You can use the java api or rest api (https://docs.camunda.org/manual/develop/reference/rest/task/get-query/).

Best regards,
Yana


#3

So, Imagine I have got today’s task with id 1234 and a list of subtasks associated with it. eg

  1. do the household chores
  2. get groceries
  3. feed the dog etc.
    Each has a variable at local level i.e. using execution.setVariableLocal(var name xyz, var value, current-execution id).
    The scope of the local variables is only at subtask level, I need to deduce the result at task level if the subtasks are completed or not using the variable set at subtask level.

I hope this clears my question.

Regards,
Udit


#4

Hi Udit,

Try with https://docs.camunda.org/manual/develop/reference/rest/history/task/get-task-query/
by providing taskVariables and processInstanceId.

Best regards,
Yana