Changing the type of a task using code


Hi there,

I am wondering if there is a way to change the type of a shape (ie bpmn:Task, bpmn:CallActivity…) using javascript. I read Edit id attribute of element which works to change the ID, but running the function below does not seem to change the type. Is there something I am missing?

 changeType(modeler.get('elementRegistry'), 'Task1234', 'bpmn:CallActivity');

 function changeType(elementRegistry, taskId, typeDesired){
           'type': typeDesired

Changing Task to UserTask (by code)

I guess, you must create another object with the type you want and replace the old object with new one.


Answered here.