Well, I cannot find a way how to make people candidates for a task. Yes, it is easy to implement EventListener which will pop up when the task is created and will assign it to a person. But if I need to check which people are eligible for this exact task? For example, members of the group X are candidates for the task by process definition, but some input parameters(or environment data) on the creation of the task say "users A, B and C are on vacation, and E and F are ineligible for the current case" and we narrow the candidate list to users G, L and R.
I didn't find any way to change candidates of the task via API. Task API allows to set assignee and owner, but not the candidates. Changing candidate list manually or automatically(e. g. parsing and changing XML) and deploying the definition is a huge workaround imo and won't work for any real amount of workflow. I can think of creating generic groups on the fly, but this approach is a workaround and has its own loopholes and problems.
The possible solution is to set candidate list by UEL expression, but it isn't possible at the moment and I suppose it isn't a priority.