Custom element issue


#1

Hi,
I’m experimenting an issue with BPMN.io, I created a custom circle element, but : when I click on its icon on the palette and then click on the canvas to create the element it doesn’t work very well. It seems I’m always dragging the icon on the canvas (to create a new element). On the console I have this error :
unhandled error in event listener
TypeError: Cannot read property ‘ids’ of undefined
_ at Object.isIdValid (bpmn-viewer-custom.js?mklr08jjor:1507)_
_ at Object.validate (bpmn-viewer-custom.js?mklr08jjor:3779)_”

I join you this gif because I can not explain my situation well in english haha

I hope you could help me,

Thanks a lot


#2

Hey there,
I experienced this many times. It’s because there is a JS object that is undefined and it’s property ids can’t be read. Because of this that JS function can’t be further processed anymore which leads to this malfunction. So you have to check your property ids where is used and why its object is undefined. For me it is usually because I forgot to require it, but it can have hundreds of reason.
Good luck.


#3

Are you using a specific example? Without any code it’s hard to guess what the problem is.


#4

I experienced this issue recently and it was a mistake by me not inheriting the modeler correctly. Parts of the modeler’s modules require the moddle module to be loaded in a specific way.

My guess would be that you created a custom modeler that misses to inherit the Modeler.prototype._createModdle function properly. This sets the ids property of the moddle object.