Error when i want create moddle

Hi,
When I want create moddle element with

var inputOutputElement = moddle.create('camunda:inputOutput');

or

var inputOutputElement = moddle.create('camunda:InputOutput');

I get error

Error: unknown type <camunda:inputOutput>

please help me how to fix this error.

thanks

Please elaborate on the context in which you’re doing this. Otherwise I can’t help you.

1 Like

this afternoon, I solved this problem, I wanted to use ‘camunda’ providers without property panel or camunda providers, I can not use nodejs and also I can not use property panel and …, now, I create a custom moddle meta model and work with this successfully :slight_smile: :wink:

thank you for your attention

1 Like

Hi @Hadi_Jami I’m stuck on some similar situation, in my case I’m trying to use a particular properties panel, so I’m not using the bpmn properties panel module. can you specify how did you solve this

with an example. Thanks in advance!

Hi Sergio.
First, I created custom property panel for my requirements and
For custom moddle meta model use this structure :

(for 2way-binding in pure javascript for properties and element I used knockout js)

You can create special custom moddle extension for each element and bind to custom property panel.

modeler = new BpmnModeler({
                    container: container,
                    keyboard: {
                        bindTo: document
                    },
                    additionalModules: [
                        bpm.getMiniMapModule(),
                        bpm.getTokenSimulation(),
                        bpm.getElementConfigContextPad()                        
                    ],
                    moddleExtensions: {
                        ep: {
                            'name': 'NAME FOR MODDLE EXTENSION',
                            'uri': 'http://g.ir/?T:67AF:CJD?X1',
                            'prefix': 'ep',
                            'xml': {
                                'tagAlias': 'lowerCase'
                            },
                            'types': [
                                {
                                    'name': 'ExtendedProperties',
                                    'extends': [],
                                    'superClass': ['Element'],
                                    'properties': [
                                        {
                                            'isAttr': true,
                                            'isBody': false,
                                            'isMany': false,
                                            'name': 'ElementID',
                                            'type': 'String'
                                        },
                                        {
                                            'isAttr': true,
                                            'isBody': false,
                                            'isMany': false,
                                            'name': 'ElementBaseType',
                                            'type': 'String'
                                        },
                                        {
                                            'isAttr': true,
                                            'isBody': false,
                                            'isMany': false,
                                            'name': 'ElementType',
                                            'type': 'String'
                                        },
                                        {
                                            'isAttr': false,
                                            'isBody': true,
                                            'isMany': false,
                                            'name': 'ElementConfig',
                                            'type': 'String'
                                        },
                                        {
                                            'isAttr': true,
                                            'isBody': false,
                                            'isMany': false,
                                            'name': 'ElementDescription',
                                            'type': 'String'
                                        }
                                    ]
                                }
                            ],
                            'enumerations': [],
                            'associations': []
                        }
                    }
                });

When bpmn element create done modeler.on('shape.create') each element has this properties in element[businessObject][extentionsElement][values][0] .

Good luck.

1 Like

Thank you so much @Hadi_Jami, it worked for me on JS, I tried it on an Angular8 project but did not work at all, but I realize a solution for this specific case, in this case (Angular) you don’t set the moddleExtensions Param like we always do, we just set the Modeler:
public modeler: any;

this.modeler = new BpmnModeler({

  container: '#canvas',

  width: '100%',

  height: '600px',

  additionalModules: [

    customControlsModule,

    { [InjectionNames.bpmnPropertiesProvider]: ['type', OriginalPropertiesProvider.propertiesProvider[1]] },

    { [InjectionNames.propertiesProvider]: ['type', CustomPropsProvider] },

    { [InjectionNames.originalPaletteProvider]: ['type', OriginalPaletteProvider] },

    { [InjectionNames.paletteProvider]: ['type', CustomPaletteProvider] },

  ]

});

and then instance a BpmnModdle apart from the modeler this way:

public camundaModdle: any;
this.camundaModdle = new bpmnModdle({camunda: _camunda});

when _camunda is the Json object with the extensionModdle structure;

forward, you create the basic extension moddle
this.modeler.get(‘modeling’).updateProperties(this.modeler.get(‘elementRegistry’).get(this.element.element.id), {extensionElements: this.modeler.get(‘moddle’).create(‘bpmn:extensionElements’)});

or if it does not work just create the moddleExtension without updating properties:

this.modeler.get(‘moddle’).create(‘bpmn:extensionElements’);

after that, you only need to create your property

const properties = this.camundaModdle.create(‘camunda:Properties’);

and then push it to the extensionModdle values:

this.modeler.get(‘elementRegistry’).get(this.element.element.id).businessObject.extensionElements.get(‘values’).push(properties);

Hope it woukld be usefull to somebody else, once again, thanks @Hadi_Jami and everyone else!

1 Like