How to dynamic add a multiUserTask in my processInstance,not processDefinition

i want to add a multiUserTask in my processInstance.And set TaskListener on
this new node.And when this node done,i want it can be monitored by my ExecutionListener.

cannot modify processDefinition.only modify processInstance. :exploding_head:
thank you everyone

@shanshui Once Process Definition is deployed to workflow engine it’s an immutable workflow definition file. Any changes to process definition will result in newer version and that’s need to be again deployed to the workflow engine.

But in my project, need dynamic add a multiUserTask :sob:

So I try to only modify processInstance :sob:

need help :smiling_face_with_tear:

Hi @shanshui - I think what you are attempting to do is very difficult / impossible with the modification API. If you share the wider objective of the process then the community might have suggestions about how you can achieve the same without a need to do dynamic structural changes to the running process.

A multi-Instance with a quantity of 1 is indistinguishable from a single-Instance. If you update your process to allow multi-instance, but set the incoming dataset to only have one value it should work.
When you need it to also support multiple, send a dataset with multiple.

Remember that BPMN is about creating reuasble, repeatable, consistent processes, so modeling the edge cases is important too.

yes. I would be very happy if the requirements could be implemented without changing the processInstance.
I even considered copying a new processDefinition and adding a node to fulfill my requirements :smiling_face_with_tear:

Not chang the quantity of multiUserTask, but by adding a new node(multiUserTask) to the processInstance

As long as I can dynamically add a new multiUserTask, I can achieve my requirements :sob:

You are being told repeatedly that you cannot do that.
We are giving you other ways to accomplish the same goal.

Your ways can’t to accomplish the same goal.