Duplicate tasks created when creating multi instance user tasks

Hi,

When creating a multi instance user task, duplicate instances are created for each element in the collection list.

Any help will be great!

Hi @deepti,

could you please share your process definition?

Cheers,
Askar

Hi Askar,

Please find my process definition attached to this email.

Thanks,

Deepti

test1-multiuserapproval - Copy.bpmn (14.7 KB)

Hi Community,

any solution on this. I ran in the same issue.

I’m starting a process with a service task leading into a user task. Once I start the process, the service task gets executed once, however I have then two different task ids waiting at my user task.

If I want to close the first user task I get a strange exception on complete.

List<Task> tasks = taskService.createTaskQuery()

.active()

.processInstanceId(processInstance.getId()).list();

for ( int i=0; i<tasks.size();i++) {

System. out .println("Task Name " + i + " " + tasks.get(i).getName());

System. out .println("Task Id " + i + " " + tasks.get(i).getId());

System. out .println("Task ExecId " + i + " " + tasks.get(i).getExecutionId());

System. out .println("Task Parent " + i + " " + tasks.get(i).getParentTaskId());
taskService.complete(tasks.get(i).getId());
}

condition expression returns non-Boolean: result has class java.lang.String and not java.lang.Boolean",

can you upload your process model?

Hi Niall,

this is what I have as a mock BPMN. It does not go pass the first user task.

Thank you for your help.

flow_minimal.bpmn (10.6 KB)

The problem is with a rouge sequence flow. It’s producing 2 tokens after the service task because 2 sequence flows are leaving it. Removing the extra flow will fix the problem

3 Likes

Huch. Thank you that fixed the issue with the user instances!

However I still get the exception when I want to complete the user task. Any idea why that could be?

List<Task> tasks = taskService.createTaskQuery()
.active()
.processInstanceId(processInstance.getId()).list();

for (int i=0; i<tasks.size();i++) {
taskService.complete(tasks.get(i).getId());
}

Well im not sure exactly if it’s the cause - but you’ve got a syntax problem with your expression on your gateway
"content.basic.hasBuildingWaste!=true"
Should actually just be something like
${!content.basic.hasBuildingWaste}

1 Like

Spot on. I had another modelling error and the wrong expression in the gate.

I changed it to ${true} and ${false} for testing purposes and it worked. magnificent.

Many thanks for your help!