Customised menu for custom elements

Hi All,
Ive looked at the bpmn-js-examples specifically the custom-elements and custom-meta-model examples.

I am looking to add a custom:element as shown in the custom-element example to with I am required to add specific menu.

I gather from the example that this is done in the CustomPalette.js file where I create the element in the Palette to be display.

To Add the specific custom menu, I created a copy of the ReplaceMenuProvider.js where I have placed specific’ if’ condition checks for my custom:element as done for the bpmn:flownode in the file and added a CustomReplaceOpions.js file too.

So far things are workingas expected, but this doesnt ensure creation of the ids or moddleElement with parent for the custom:element object and the condition check in the ReplaceMenuProvider.js return the menu entires as [].

Also I looked at the custom-meta-model example and creates a custom.json file extending the bpmn:FlowNode element. I then passed this json to Modeler/Viewer object as moddleExtensions options as shown in the custom-meta-model example.

Even so I was not able to get the menu populate for the custom:element. On debugging the flow, the business object created does not show the object with id , parent moddleElement etc as shown for any other bpmn element. The custom:json is written extended from a bpmn:FlowNode.

For all the debugging Ive done I also would want to know if Im right on the 2 points:
– CustomPalette creates any custom:element type
– a custom.json file is a must to ensure the moddleElement.create is called as done for other bpmn elements.

I dont know what I have missed. Can anyone help me find the missing piece in the puzzle?

Would really help if anyone can provide some examples as to how this can be achieved as I am new to node.js.

Regards
SK