Hi,
I’m trying to dynamically set the user(s) that can claim a task. I’ve written a Task Listener that is invoked on create that programmatically sets the user:
<bpmn:userTask id=“Task_08ytsyj” name=“State 1” camunda:formKey=“embedded:app:forms/approve-loan.html”>
bpmn:extensionElements
<camunda:taskListener class=“com.myco.bpm.SetAuthorizedApproversTaskListener” event=“create” />
</bpmn:extensionElements>
bpmn:incomingSequenceFlow_1j4f7vc</bpmn:incoming>
bpmn:outgoingSequenceFlow_0z324z2</bpmn:outgoing>
</bpmn:userTask>
public class SetAuthorizedApproversTaskListener implements TaskListener {
public void notify(DelegateTask delegateTask) {
UserTask userTask = delegateTask.getBpmnModelElementInstance();
List<String> candidateUsers = new ArrayList<String>();
candidateUsers.add("buser1");
userTask.setCamundaCandidateUsersList(candidateUsers);
userTask.setCamundaCandidateGroups("accounting");
System.out.println("Assigned BUSER1");
System.out.println("Assigned Accounting");
//Input from Modeler
I start the process and the ‘demo’ user can claim the task which is not the behavior I want. I would expect that only BUSER1 can claim the task. Can someone help guide me here?
Thanks!
mkc