Changing Task to UserTask (by code)


Hi all,

I’m trying to find the code to change the type of a shape by code (change a task to a user task). What is the best way to do this? I found this and opened that - but I suppose there must be a simpler solution?
I tried to figure out what happens when you click the user task submenu button - but didn’t find it.

Thanks for any help!


Changing the type of a task using code

Got it:

var modeler = new Modeler();
var element = modeler.get('elementRegistry').get(id);
var newElementData =  {
    type: 'bpmn:UserTask'

var replace = modeler.get('replace');
var newElement = replace.replaceElement(element, newElementData);