Camunda Task without Process

Hi guys,
I need to create a multiple types of Tasks that haven’t a parent. I need to set a label/key that contains the type of my task.
Afterwards, I need to execute a Query and retrieve all task of specific type.

What is the best practice for this scenario?

Thanks
Luca

Hi Luca,

not 100% sure but you could try the following code snippet

//Save task with specific type
TaskEntity task=(TaskEntity)taskService.newTask();
task.setTaskDefinitionKey("myTaskType");
taskService.saveTask(task);

//Query for tasks	
taskService.createTaskQuery().taskDefinitionKey("myTaskType").list();

Best regards,

Markus

2 Likes

Ok but I need to create task via Rest API. I don’t see this field into documentation.

https://docs.camunda.org/manual/7.6/reference/rest/task/post-create/

Is it possible via Delegate only?

Thanks

Hi,

you are right.
seems that this field is not exposed to rest api.

Maybe you can implement your own controller.

Best regards

1 Like

Hi @Markus,

may be it would be an option for you to create a task and then set a variable into it?

Cheers,
Askar

Yes but The search on variables is more expensive I think.

Hi @aakhmerov ,

good idea but I think you wanted to reference @lsantaniello because it was his question :wink:

Best regards,

Markus

1 Like