When we have a task with an assignee defined like :
<userTask id="task" name="Task" camunda:assignee="${user}" camunda:candidateUsers="${user}">...</userTask>
- If the ‘user’ variable is null or blank string just before the task execution, which problems may we face (retrieving candidates for such task, assigning this user task, etc…) ?
- In the past, using activiti 5.14, we have experienced some NullPointerException when using null variables as activiti:assignee, raising this exception in runtime. In any case, we need to avoid this behaviour
Hi Rubén,
the process engine can deal with user tasks when the camunda:assignee
is null
. In this case, the task is just not assigned.
If camunda:candidateUsers
is null
then the engine throws a ProcessEngineException since it expects a String or a Collection.
Otherwise, if camunda:assignee
or camunda:candidateUsers
is an empty String then the engine assign the task to a user with empty id. This is maybe not a good idea.
Note that you can also assign tasks to groups or resolve the assignee using a bean.
Greetings,
Philipp
Hi Philipp,
Thanks for your answer. It is good to know that if it is null, the task is not assigned to anyone, apparently, the case where assignee is null should not present problems in Camunda, instead of in Activiti 5.14.
In addition, we also need to know what happens if the list candidateUsers there is a null value, although this is more rare.
Thanks again,
Hi Rubén,
if one of the candidate users you set on camunda:candidateUsers
is null
then the engine throws a ProcessEngineException.
Note that you can easily try it out by yourself 
Greetings,
Philipp