Modifying attributes on diagram elements (e.g. name)

Hi there,

We are having very good results customizing the library to fit our needs, but we aren’t able to customize the name (label) of both Start and End events.

The weird thing here is that we succeed doing the same for tasks, and actually the name is properly changed for Start and End events if we inspect the XML generated, but remains unchanged on screen. This is what we are doing:

  1. e.element.businessObjects.name = “some name”
  2. eventBus.fire(‘element.changed’, { element: e.element });

Are we missing something?
Thanks!!
Cristian.

Your code will update the displayed name perfectly fine. It will just not update the right element because the name changed on the events label. Access an elements label (if it exists) via e.element.label.

You can have a look into Modeling#updateProperties, too. It properly updates properties of an element and makes sure the changes properly end up in diagram + XML:

var startEventShape = elementRegistry.get('some-id');
modeling.updateProperties(startEventShape, {
  name: 'New name'
});

Whenever you would like changes to be undoable (and to end up in the BPMN 2.0 XML) they have to be carried out via the modeling service anyway.

What are you guys building by the way? Any chance we can feature it?

3 Likes

Thanks Nikku!

We are trying to integrate bpmn.io in a product we develop. But our product uses a small set of bpmn elements, so that’s why we need to customize the library. In addition, every element must have custom metadata that only have sense within our product, that’s the reason why we need to customize labels, add custom meta model, and so on…

I already told you this, but you guys are doing an amazing job… we are anxiously waiting for the lanes and timer boundary events to come (we believe those are the only stuff that are avoiding we can actually use it in production, but we know both are in roadmap so we started to develop with the current set of elements). If you need help, a different point of view, an opinion, just let me know, I’ll be glad to help.

When we get to the point of having a “displayable” prototype, I’ll tell you for sure =)

Feel free to contact me for anything.
Cheers!
Cristian.

Hi Nikku, about that “time” I said in my last response (“When we get to the point of having a displayable prototype, I’ll tell you for sure”) … that time came.

In the past days we introduced Flokzu, a tool for SMEs with the goal of help them to put some order in their internal document workflows.

We have plans to launch in 20 days aprox… but you can get a sneak peak in http://www.flokzu.com

Regards,
Cristian

Please do not necrobump old topics. Instead link to this thread from new topic.

When you open the new topic: Try to give us some more information. Can you give us the full error stacktrace? Can you give some code, so we can help you in detail?