Element's children

Hi. Apologies in advance if this is a basic question. But if an element is added to a diagram, I can get to that element’s object by using the element registry. But if that element has a child element in the XML then the element registry doesn’t seem to give me access to that.

For instance, given this XML element:

<bpmn:intermediateCatchEvent id="Event_0b267wr">
       <bpmn:timerEventDefinition id="TimerEventDefinition_08vc3yw" />
</bpmn:intermediateCatchEvent>

I can get to bpmn:intermediateCatchEvent using the element registry. But it’s children property is always empty.

I’ve also tried using filter and getAll in the element registry but the bpmn:timerEventDefinition element is not returned by those functions either.

So how can I get access to the bpmn:timerEventDefinition element?

Hey,

What you are looking for is the eventDefinitions property of the businessObject of the shape that you’re dealing with.

Please have a look at this example: https://codesandbox.io/s/practical-taussig-ecypq?file=/src/index.js

In line #43, we console.log the eventDefinitions of given event. Which is an array.

1 Like

Thanks loads for that, big help.

But now I have the event definitions, is there a way to update them, e.g to add a child element?

For example, I am trying to achieve something like this:

<bpmn:timerEventDefinition id="_erIyiJZ7EeSDh8PHobjSSA">
    <bpmn:timeCycle id="_erIyiZZ7EeSDh8PHobjSSA" language="cron">0/1 * * * * ?</bpmn:timeCycle>
</bpmn2:timerEventDefinition>

Can that be done?

Hey,

We’d like to have different forum threads for each question as it’s easier to search later on for other users as well.

Could you ask your new question in a separate thread please?

1 Like

Apologies, makes sense. I’ve created this new topic - Add to or update event definitions

1 Like