Task Service null pointer on or query

I am trying to get the list of task with the below method and getting null pointer exception. I have a bpmn with a CMMN as an activity thats why tried with an or to get the list of task list. What am I missing?

taskService.createTaskQuery().processInstanceId(caseInstanceId)
.or().caseInstanceId(caseInstanceId).list()

Consider using business keys instead of process instance id’s that would make it a lot easier as a business key can be passed to multiple related processes instances you can read more about it at this post.

1 Like

@Niall But I cannot fetch list of task with bussinessKey, its has very limited use :frowning:

I haven’t test it but something like this should work.

         .getTaskService()
            .createTaskQuery().caseInstanceBusinessKeyLike("").or().processInstanceBusinessKey("a").endOr();

@Niall “Or” is not working. When I query individually it is working.

Take a close look at Niall’s latest post.
You’re missing the endOr() before using .list().

1 Like

@langfr endOr() solved null pointer exception, but the query was returning list with size 0 eventhough task were available.