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!


Got it:

var modeler = new Modeler(); // or BpmnJS if you use the pre-packaged distribution
var element = modeler.get('elementRegistry').get(id);
var newElementData =  {
    type: 'bpmn:UserTask'

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

I am using the BPMN in native javascript
But its giving the error
index.html:2884 Uncaught ReferenceError: Modeler is not defined

Any one can help what i have to do for this class new Modeler();

Hi @mjunaid

Replace Modeler with BpmnJS in native javascript.

1 Like

Please do not necrobump old topics. Instead link to this thread from new topic.