How to assign tasks to the specified user?

Hi
I drew the following model:

diagram_2.bpmn (10.4 KB)

As you realized:
a) one of the members of userGroup1 registers some information.
b) one of the members of userGroup2 makes a decision about that information which the decision has two options:
b-1) everything is fine and the process goes to ‘Notification’ userTask.
b-2) the member of the userGroup2 wants to edit the information registered by the member of userGroup1.
In this case, I want to assign the ‘Edit’ userTask only to the user who makes the decision to edit the information.

But I don’t know how.
I’ll be grateful if you guide me.

No one doesn’t know?

You could create a task listener that queries the history of the process instance for the task that was completed, this would give you the id of the user that completed the task, then you can put that into a process variable and use and expression on the assignee field to populate it.

2 Likes

@Niall
I have never used the task listener and I am not familiar with it.

Can you please give me a link to the tutorial related to the task listener that will help me learn what you said and be able to implement it?

In the camunda modeler, I added a listener for the user task with these entries:

1

And I don’t even know how can I write java codes… :roll_eyes:

Hi @rezza72

see the attached model. you can do it by writing just one line of code :slight_smile:

getApprover.bpmn (3.2 KB)

Hope it helps you

2 Likes

I must say that @mrdavoodi64’s answer is pretty much perfect :slight_smile:
Especially in your situation where you don’t use java.

2 Likes

myHalloProcess.bpmn (3.1 KB)

public class MyDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
delegateExecution.setVariable(“kermit”,“userdemo”);
System.out.println(“MyDelegate…”);
}
}

1 Like

@hung
Thanks.
Where can I use this java code?

see in the process definition.