Create task with sentry programmatically

Hi everyone

I’m trying to create a task using the taskService and set an entryCriterion with an If_Part condition.
I already create the task but the problem is with the entryCriterion.

How can I create an entryCriterion and associate it with the created task?

Best regards,
Alberto

Hi @milyiyo,

That is not possible. The task you create via TaskService is not related to a CMMN plan item. However, sentries are based on plan items, i.e. they define when a plan item becomes available. CMMN has a concept for creating adhoc tasks, called discretionary tasks. That might be what you are interested in, yet, I am afraid that is not implemented.

Cheers,
Thorben

Thanks @Thorben,

Could I create a Plan Item programmatically and then associate it to my task using setTaskDefinitionKey?

Example:
myTask.setTaskDefinitionKey(<taskDefinitionKey>);

That is not possible. Plan items (as well as sentries) must be part of a deployed CMMN case definition.

Now you can create and deploy CMMN case definitions programmatically, but I am not sure if this what you want.

Ok @thorben, thanks a lot :slight_smile: