Get SuperClass of businessobject

Hi
I can getting a businessObject like

let businessObject = getBusinessObject(element)

Now, i am searching a way to get the superclass of the businessObject. I have for example different Gateways (event based gateway, complex gateway, …). I have now extend some logic when the user clicks a gateway. Now I do not want to check all gateway-types instead I want to get the superClass and check if it is a gateway. How can I get this?

Thanks for your help.

best regards, Thomas

There’s a utility that you can use:

import { is } from "bpmn-js/lib/util/ModelUtil";

...

if (is(element, "bpmn:Gateway")) {
  ...
}

This utility uses the $instanceOf method of the business object. This method also takes inheritance into account (cf. moddle/extension.js at 5ccd72821bcf953fc6bbe63a25127158646a92f5 · bpmn-io/moddle · GitHub).

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.