# I want to change label of element

**URL:** <https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017>\
**Category:** Developers\
**Created:** [January 10, 2019, 9:03am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017 "2019-01-10T09:03:38Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 10, 2019, 9:03am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/1 "2019-01-10T09:03:38Z")

</div>

![25](https://forum.bpmn.io/uploads/default/original/2X/0/0dc24c0be765384fc23d7953fac94e304f819737.png)

I tried to use the modelig.updateProperties function, but I can not use it because the xml has been changed.  
So when I changed the text using the style, the same thing happened.  
I do not want xml to change, but I want the label to change visually.

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [January 10, 2019, 9:18am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/2 "2019-01-10T09:18:28Z")

</div>

Please give more context. What exactly are you trying to achieve?

What do you mean by

> [@yejin\_LEE](#):
>
> but I want the label to change visually.

---

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 10, 2019, 10:05am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/3 "2019-01-10T10:05:58Z")

</div>

I originally intended to do this,

```auto
modeling.updateProperties(shape,{name: 'aa'});

```

This way has a problem that the xml data is also modified.  
So I do not do this way.

```auto
 var graphics = $(modeler.get('elementRegistry').getGraphics(element));
                        graphics
  graphics.find('.djs-visual > text > tspan').text('aa');

```

The problem with this way is that the x and y values ​​applied to the tags are not appropriate,  
So it is not centered and it is displayed at a strange position.

I hope the two conditions are satisfied.

want to Change the label of the element,

Hopefully the xml data will not change and the labels will be centered. only change visually

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [January 10, 2019, 10:24am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/4 "2019-01-10T10:24:57Z")

</div>

The whole point of using `updateProperties` or any method that modifies the model is that the XML that represents the model will reflect these changes.

What is you use case?

---

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 10, 2019, 10:27am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/5 "2019-01-10T10:27:48Z")

</div>

I wish xml did not change

So now I can not use that function(updateProperties)

I just want it to be seen in different texts.

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [January 10, 2019, 10:40am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/6 "2019-01-10T10:40:59Z")

</div>

What’s the point of the rendered text not reflecting the name of an element?

---

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 10, 2019, 11:04am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/7 "2019-01-10T11:04:21Z")

</div>

I am doing multilingual processing now,  
and I want to have the basic language stored in the xml information and  
to reflect the multilingual language at the time of drawing.  
so i do not want xml to be modified,

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [January 10, 2019, 12:44pm UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/8 "2019-01-10T12:44:46Z")

</div>

How do you want to handle translation? Do you want to store translations in the XML, in a seperate file or do it on the fly using a web service?

---

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 11, 2019, 1:01am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/9 "2019-01-11T01:01:17Z")

</div>

I have the translated data.

so, So it’s a good to know how to process with the above problems in the modeler and viewer.

---

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 11, 2019, 8:46am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/10 "2019-01-11T08:46:04Z")

</div>

in viewer,

can i delay shape.render ??

I get the data from the server asynchronously,  
I want to change the label of the element again based on it.  
However, since the data is not received and render is performed, the desired label is not output.  
and the default label is output, then it is replaced by the value received from the server.

So, for example,  
It turns out that the change from ‘a’ to ‘b’ is problematic on visual.

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [January 14, 2019, 8:27am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/11 "2019-01-14T08:27:05Z")

</div>

You can postpone the diagram import until you retrieved the translations. For rendering the translated labels without changing the underlying model you can modify the [renderer](https://github.com/bpmn-io/bpmn-js/blob/master/lib/draw/BpmnRenderer.js) to look up the translation when rendering a label.

---

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 14, 2019, 9:01am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/12 "2019-01-14T09:01:37Z")

</div>

how to postpone rendering??

Please explain with specific code.

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [January 14, 2019, 9:11am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/13 "2019-01-14T09:11:08Z")

</div>

What I mean is simply not starting the import until you have the data. Call `importXML` once you’re ready.

---

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 14, 2019, 9:14am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/14 "2019-01-14T09:14:10Z")

</div>

If i defer importXml, i will not be able to know the information contained in each element.  
i must call the server’s api with the value contained in each element(Received via xml).

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [January 14, 2019, 9:46am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/15 "2019-01-14T09:46:45Z")

</div>

You can also separate [generating the model](https://github.com/bpmn-io/bpmn-js/blob/master/lib/Viewer.js#L168) and [importing](https://github.com/bpmn-io/bpmn-js/blob/master/lib/Viewer.js#L188) and retrieve the data in between.

---

<div class="post-metadata">

**Author:** ![yejin\_LEE](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/y/d2c977/32.png) [@yejin\_LEE](https://forum.bpmn.io/u/yejin_LEE)\
**Post date:** [January 14, 2019, 10:03am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/16 "2019-01-14T10:03:00Z")

</div>

how to separate??  
Do you have sample code?

---

<div class="post-metadata">

**Author:** ![philippfromme](https://forum.bpmn.io/user_avatar/forum.bpmn.io/philippfromme/32/2803_2.png) [@philippfromme](https://forum.bpmn.io/u/philippfromme)\
**Post date:** [January 14, 2019, 10:27am UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/17 "2019-01-14T10:27:44Z")

</div>

First you parse the XML using [bpmn-moddle](https://github.com/bpmn-io/bpmn-moddle/), then you can call [`Viewer#importDefinitions`](https://github.com/bpmn-io/bpmn-js/blob/master/lib/Viewer.js#L357) directly.

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [July 22, 2025, 3:29pm UTC](https://forum.bpmn.io/t/i-want-to-change-label-of-element/3017/18 "2025-07-22T15:29:08Z")

</div>

Closed on July 22, 2025, 3:29pm UTC


