Not able to use moddle.create as a separate service

When I use moddle.create() in the same file where I have defined definitions and moddle, then it works fine. But if I use the moddle.create in a separate service file then it gives error. I am attaching the code and error below.

Code:

Service:

static createBpmnTask(moddle,attributes){
      const bpmnTask = moddle.create("bpmn:Task",attributes);
      return bpmnTask;
  }

Its usage:

 const bpmnTask1 = BpmnService.createBpmnTask(moddle, {
        id: "TaskId",
        name: "Component Voice",
        outgoing: [seqFlow1],
        "voice:taskType": "playVoiceFile",
        "voice:voiceFilePath": "/filePath",
        "voice:voiceFileInfo": "Fileinfo"
    });

Error: Cannot read properties of undefined (reading ‘isGeneric’)

Hi,

do you have custom moddle extensions? Did you add them in both of your files?

For further assistance, please share a CodeSandbox that reproduces your issue in a way that we can inspect it.

Thanks, solved the issue

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.