I am starting a process instance from springboot and once a task is created, I need to know the list of active user tasks with the current instance. so I have written below code in the create event of the task listener → notify(). but I am always getting null value. can you please help me identify the issue or provide a solution for my requirement.
List taskList = taskService
.createTaskQuery()
.processInstanceId(delegateTask.getProcessInstanceId())
.list();
Thanks @Adagatiya for your reply. Okay let me take a step back. So I have written code to trigger a camunda process as below. ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(“scoping_letter”,“127”,variables);
As you mentioned above, the process is initiated and the user task is created. I have create event which is invoked as the flow reached this task, I added another event (assignment) to capture the task details through taskService(). As shown below.
@jonathan.lukas . Thanks for your reply. so basically, we are using camunda as headless implementation. so UI is in angular. user clicks on create workflow button and inturn calls the springboot api. Here we are triggering a camunda instance. now we have to capture the task details within camunda and perform certain manipulations and then insert these details into application db. so basically every action that happens on UI, will be done through java code on camunda process/task and saved in application db. Hope I havent confused you. please let me know if there is any other way to capture these details.
Thanks for the bpmn correction.
this sounds reasonable. Why wouldn’t you place the task query outside of the engine api call? There, you have no running transaction and can be sure everything is saved to the database.
Or, you could use the listeners to just sync the state of the current task to your application db.
I understood the 2nd option. So basically you mean, when the event is create → Insert record in db and upon assignment → update the status and complete → close the task.
But 1st option I am not sure, when you say outside engine api call. can you give an example or brief more on this.