Omit properties in XML

I am using properties panel and moddle extension to model my bpmn diagrams. I noticed that properties contained in my moddle are saved as attributes of the elements businessObject, whereas properties not contained in my moddle are saved in $attrs. I was assuming that only properties contained in my moddle from businessObject will be saved in xml, but now i realized that all properties are saved. How can I have properties, which are accessible but won’t be saved in xml whenever I do bpmnModeler.saveXML({format: true});?

This is the expected behavior :+1:

Can you maybe tell more about your use case? What kind of attributes do you have that shouldn’t go into the XML? Why do they have to be maintained in the businessObject on runtime?

but now i realized that all properties are saved

Are you able to share this inside a CodeSandbox?

Lets assume users can click on a task element and gets 2 textboxes to provide some information about this task:

group.entries.push(entryFactory.textBox(translate, {
                    id : 'property1,
                    label : 'property1',
                    description : 'property1',
                    modelProperty : 'property1'
                }));

group.entries.push(entryFactory.textBox(translate, {
                    id : 'property2,
                    label : 'property2',
                    description : 'property2',
                    modelProperty : 'property2'
                }));

When the user wants to download his bpmn diagram, he gets a xml file from bpmnModeler.saveXML({format: true}), containing task elements with attributes property1 and property2. But my goal is to separate those 2 properties and e.g. leave property2 out of the exported xml file, because I am storing property2 in a separate file manually. Therefore I want to avoid having property2 too also be inside the xml file.

Thanks for sharing some details :+1: I fear that the old properties panel makes it hard to maintain properties outside of the meta model, since the way it was built meant to be a 1:1 representation of the underlying XML.

However, we are close to release a new stable major version of it. We encourage to consider using the latest version of bpmn-js-properties-panel. It makes creating your own extensions a lot easier!

One use case is, for example, to populate properties in the UI with data that don’t rely on the XML (e.g. external data, but also custom data structures you could come up with). To get started with extending the properties panel check out this example: bpmn-js-properties-panel Extension Example.

In case you’re giving it a try, we’d love to hear your feedback! :heart: