I have a scenario wherein a user task(A) is followed by another user task(B). And based on feedback of B, flow may go back to A.
Difference in two instantiations of A is that first time it is to be assigned based on a candidate group, while second time it is to be assigned to the exact user who actually worked on it first time(as feedback from A is for that specific user).
How can this be achieved?
I think I can have both activiti:candidateGroups and activiti:candidateUsers for A defined in process definition xml.
And then in java code I can query for all possible tasks for the user, and check accordingly.
Would it be a good approach?
You are correct, both Candidate Groups and Candidate Users are allowed on the same task. Activiti ignores (and apparently allows) null values in candidate assignment, so you can provide different variables both in Candidate Groups and Candidate Users, the one which is null will be ignored. you can nullify variable based on your logic of Task B.