Insert user-task from one process to another


I have the following use-case with a user-task.

  • A user-task (say id T123) is created with some activity in Process P1.

  • P1 should be able to go to “completed” state without actual performing(completing) of the task T123.

  • The same user-task (id T123) should be performed as part of a Process P2 (whenever it instantiated in future).

(So T123 is a halt point for P2 and not P1).
Wonder what would be a good practice to achieve it.

@andypr why do you want same usertask in both processes?

Thanks for the prompt response.
It is because, from overall process perspective (where P1 and P2 can be thought as children processes), It is the same user-task -
in P1 its created and in P2 it is performed -
and the task’s life-cycle has to be tracked (so I suppose doing it by task id is natural). Does it make sense?

Because, that is our use case. The two activities (creating of task and performance of task) to be tracked as part of two processes.

There is a custom controller that spins out different processes (1 followed by 2) at different time.
A user task gets created as part of the process 1.
The same task should be performed as part of the process 2.

Is it achievable / advisable through help of standalone task with the pattern above?
There is not much I could find. Thanks for the help in advance.

@andypr, Yes, it’s possible to communicate between the tasks in the different process/pools using intermediate message events/Receive task.

Reference: processCommunication.bpmn (8.9 KB)

In the UserTask Task 2.2 --> TaskListener --> Complete Event --> Delegate Expression --> Provide implementation to correlate the message with name “completeTask”.

In the messageSender listener provide the implementation like this:

       .setVariable("CANCEL_REASON", "someReason")
       .setVariable("CANCEL_TIMESTAMP", new Date())

In the ReceiveTask 1.2 --> Message Name --> configure the message name as “completeTask”.

For more details, refer this blog for Fluent API for Message Correlation.

Thanks Aarvind. I am interested to know if one can do it using standalone task as well?
With standalone user-task, one can have user-defined task id.
However, it does not look like the same is possible when a user-task is not standalone and defined in a process definition. (You can set task-id in the properties panel, but that will be registered as task name in the db instead.)

@andypr Are you refering standalone user task as manual task?

If yes, you can have that in the process but engine doesn’t provide any life cycle or execution of such task types. It’s used in the BPMN process for just representation purpose and engine will pass through that activity always.


The example below shows the process of Cart Inspection. The tasks about sign-off are both manual task that are performed without the aid of any process execution engine or software systems.


The two are different. Standalone User task (which I recently learned about.) does not require one to start a process shell ( and hence no corresponding process definition and instance id). A user-action can create a standalone user-task through rest/java (taskService.newTask()) api. and it will appear in task-list, will have its life-cycle.
Here you can define the id as well. Not sure if the same can be done when it is part of a process.