How to choose user assignee based on candidateGroup or assignee?

Hi
Continuing the previous topic:

With the help of @Nele and @mrdavoodi64 , I was able to implement what I wanted…

diagram_2.bpmn (11.1 KB)

As you can see, the “Decision” userTask has Assignee and Candidate Group.

If the process leads from “Registration” to “Decision”, I want to assign the task, based on the Candidate Group field which was filled in the “Decision” before.
And if the process leads from “Edit” to “Decision”, I want to assign the task, based on the Assignee field which was filled in the “Decision” before.

I used the execution.setVariable("determinerID",""); script in the flow which connects Registration and Edit.

However, the process did not reach the “Decision” I expected.

Actually, I want, only the user who made the edit to be able to decide about the edited information and for other cases the “Decision” userTask to be assigned with its Candidate Group.

Hey @rezza72 ,

Just to understand it correctly: If a new instance is started and goes from registration to decision, you want to set the candidate group for the “decision” task in the task registration?
Currently you are using expression language in your form. This won’t work. You can basically set a variable in the form of the registration task
Screenshot from 2022-02-14 11-50-54
and then access the variable in the decision task using an Expression:
Screenshot from 2022-02-14 11-51-20

Cheers
Nele

1 Like

@Nele
I created “userGroup1” and “userGroup2” variables in the Registration userTask.
And everything is fine, before I add the execution.setVariable("determinerID",""); in that flow.
What is my mistake?

p.s: I checked the posted model again and realized I used “${userGroup1}” instead of userGroup1 in the “Registration”.
And then I corrected the mistakes and updated the model in post #1.
But the problem still exists.

(Actually, I followed the variable definition in my main model correctly. I drew the model in #1 post just for mentioning what I want. because the main model is super big and may cause some mistakes.)

Hey @rezza72 ,

If you declare and initialize a variable in a user task you don’t have to set the variable with script to the process scope. When the user task is completed by the user the variable and the value will be set to the process.

So if you declare a variable called “userGroup1” (variable id) and give it the value “Management” ( The field the person in the user task fills in.). If you then use an expression like #{userGroup1} in the next user task for the candidate Group , the expression access the value of that variable. So in the case described above it will be assigned to the group “Management”.

1 Like

Hi @rezza72

You can set assignee of the task in the “Decesion Task” with the following command :

for example : task.setAssignee(“john”);

so it causes that Group members can not claim this task anymore.

Hope this helps you

1 Like