Reset Element's Business Object

Hi there,

I’d like to reset an element’s business object which is passed to PropertiesProvider.getTabs.
I tried to do something like

element.businessObject = new (modeler.get('moddle').getType('...'))();

but that didn’t work as the real business object wasn’t updated, i. e. the model itself didn’t change.

Any help is much appreciated! Thanks in advance and best regards
Felix

I - kind of - solved this problem for myself although I’m not sure whether this is the way to go.

I now reset the business object when the set method of a custom properties panel entry is called via:

let bo = getBusinessObject(element);
for (let i in bo.$descriptor.properties) {
    bo.set(bo.$descriptor.properties[i].name, undefined);
}

But as this happens in - kind of - linear time it might be better to create a new object. If there are any suggestions for further improvements, they’re very welcome!

EDIT: Be carefull though - this will reset the id as well.