Access Process from Participant businessObject

Hi, I have the following problem:

I wanna access the ‘process’ element that is the parent of a given start event. That is very simple when there is only one process in the diagram, but when lanes are created, the parent of the event becomes the ‘participant’.

I know I can access the process throw startEvent.businessObject.$parent, but this way I get the process businessObject and I cannot call modeling.updateProperties using a businessObject, that function expects the element.

I also tried to call elementRegistry.get(‘process_id’), but the same problem arises. When there are multiple processes, the element registry doesn’t contain the processes and gets populated by participants instead.

Anyone knows how to deal with this limitation?

Thanks in advance,
Gonzalo

Hey,

once you create participants your’re effectifely turning a process into a collaboration so there is no process anymore. If what you want to get the parent element of an element which in your case would be a participant you can get it via element.parent. If what you want is to get the root element of your diagram be it a process or a collaboration you can get it via canvas.getRootElement().

Hope that helps.

Each participant can reference a process. And when the diagram gets deploy (in camunda engine in my case), is the processId what I use as a key to launch those processes. So I still need to access the processId that is referenced by the participant.

You are always able to traverse the BPMN 2.0 Meta-Model, too:

var participant = ...;

// may not exist for collapsed pools/participants
var proc = participant.processRef;

Checkout the full source of all defined types and relations. We are not doing any magic here. All that stuff is defined as part of the BPMN 2.0 specification.

I know I can get the businessObject of the process throw participant.processRef.

What I want is the element, so I can use the function updateProperties on it. Is there any way to access the element from the businessObject?

Cheers, Gonzalo

This is the relevant piece of information we needed.

As @philippfromme already mentioned, there is no Process element anymore in a collaboration diagram. You’d need to create your own command handler that is able to update the business object alone.

1 Like

A command handler, that is what I needed to know.

Thank you @nikku and @philippfromme.