Keep assignee from one task to the following

Hi,

We found many situations where the assignee of a task has to be the assignee of the next task which is generated by following the process Flow.
Is it a way to indicate this in the modeler for the process to put the assignee when create the next task ?

thanks,

Toni

Hi Toni,

You could use a TaskListener (http://www.flowable.org/docs/userguide/index.html#taskListeners) with the assignment event type to assign an assignee. You can use the HistoricTaskInstanceQuery on the HistoryService to lookup the assignee of the previous task and then assign this value to the new Task.

Best regards,

Tijs

Or, alternatively, use such a task listener to capture the assignee on complete in a (transient) variable and use it in the next task like assignee="#{previousAssignee}"

1 Like

Hi,

That sounds good !
I will find how to define a “transient” variable for having the assignee for the next Task.

Thanks,

Toni,
You say there are many occasions where following tasks are assigned to the same user.
However, in general it is not considered good practise to model processes this way.
It all comes down to the definition of a task and the desired user experience.

Let’s assume a task is a piece of work to do.
So, if a task (unit of work) is completed, the process should move to the next unit of work.
If the next unit of work is assigned to the same user, then th question becomes, what was stopping this being handled in the previous task?

Often people answer this by saying they need a wizard style UI, or need to run services based on data collected in the previous task. Neither of these re good reasons to model subsequent tasks to the same user.

If you need a wizard, then build a wizard in the UI, angular has lots of ways to do this.
If you need services run, then call these on completion of the wizard step but without completing the task.
There are many ways to handle this.

Consider the user experience of modelling following tasks to the one user. User completes task 1, then has to return to the portal/tasklist select the new task, open it and then complete it.

That said, on many occasions it is important to capture the user that completed a specific task so a subsequent review or amendment task will be correctly assigned. For this, either Jorams’ or Tijs’ options work well. I personally prefer Joram’s approach, it is simple, easy to implement and requires no custom service task.

Hope this adds some insight.
Greg