How to use User Task and complete it

Hello ,
I know how service task works with Spring Boot.It basically calls a Java class and completes the flow.
But how do we execute a USER TASK with Spring Boot.Can anyone provide a small example.

Hi @my_camunda_profie_1

Typically a user task represents a task that must performed by a user. In order to “execute” a user task, the only thing you can do is to complete a user task. That will cause the process to continue past the user task to the next activity.

You can complete a user task using the Camunda REST API (Complete Task | docs.camunda.org) or the Java API. Fx somehting like this. The following snippet first runs a task query using a process instance ID. Assuming this only returns a single Task, the second snippet shows how to complete the task to make the process continue:

Task task = processEngine
        .getTaskService()
        .createTaskQuery()
        .processInstanceId("ProcessInstance-ID")
        .singleResult();

processEngine
        .getTaskService()
        .complete(task.getId());

Hope that helps.

BR
Michael

2 Likes