Update all UserTask's model schema available in running process

Hi, I am having a requirement to fetch all the available user tasks in the bpmn file for a process instance id. Then update candidate groups and users for user tasks. And changes should be reflected even if currently execution is at updated userTask or execution is at previous stages to that user tasks stages.

For Ex :

start → userTask1 → userTask2 → end

currently task is assigned to userTask1.

I need to change the groups and users for both the stages and then changes should be reflected in the running process.

Hi @sidjain

I am not usure, I understand the case you describe, but if you want to change candidate groups / users for tasks that have not been executed yet, but eventually will be, you can use expressions that will be evaluated at runtime instead of setting them at design time using the Camunda Modeler.

Have a look:

In the following example, the assignee will be set by calling the findManagerOfEmployee() on the ldapService Spring/CDI bean. The emp parameter that is passed is a process variable.

<userTask id="task" name="My Task" camunda:assignee="${ldapService.findManagerForEmployee(emp)}"/>

Expressions also supports simple process variables.

Hope that helps

BR
Michael

Hi @mimaom,

Thanks for your reply. Actually, I am doing this. For this, we need to give the expression or variables while designing the process.

But I am looking for a way to change the expression/variable in a running process for a user task which is not even executed yet.

Hi @sidjain

Why do you need to change the expression on tasks that have not yet been executed? I mean an expression will be evaluated once the process arrives at the user task and that way you can have a bean / process variable return the candidates you want at that time. Am I missing something? :slight_smile:

BR
Michael

Hi @mimaom

Let me re-clear what I am trying to do. I have a userTask which is not executed yet.Before reaching execution to that userTask, If I want to assign that task to some other user, but it will not on the basis of any expression, it will be a manual option to admin user to add any other user to that userTask. Then how we can do that.

Regards,
Siddarth

Hi @sidjain

OK, I understand. So it’s more like a DevOps / system management thing that the assigned user of the user task must change.

I would allow the admin user to interact with the process instance (perhaps via a small custom UI or using the REST API of the process engine) and then simple write the value of the candidate user into a process variable and use that as the expression of the user task (in the Modeler). That is clean and simple.

It sounds more like you are thinking about changing the process definition model at runtime (which I am not sure you can without creating a new deployment). I would not go down that road.

BR
Michael

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.