Changing the type of a task using code


#1

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){
      modeler.get('modeling').updateProperties(elementRegistry.get(taskId),{
           'type': typeDesired
      });
 }

Changing Task to UserTask (by code)
#2

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


#3

Answered here.