CallActivity how to handle it and visualize it

I’m working on this code. but i’m having some problem. How can i handle the call to the process that i consider inside the call activity? is possible to “expand” the call activity to check the process inside? and how can i make this?

async function subProcessGeneration(id_passed, content_label, diagram_to_import) {
  try {
    const id = id_passed;
    const elementRegistry = viewer.get('elementRegistry');
    const not_exists = elementRegistry.get(id_passed) == undefined ;
    if(not_exists){
      const subprocess = elementFactory.createShape({
        type: 'bpmn:CallActivity',
        id: id,
        name: content_label,
        isExpanded: true,
      });
      subprocess.businessObject.id=id_passed;
      
      //subprocess.di.id=id_passed;
      const mainProcess = canvas_ref.getRootElement();//getMainProcess();
      modeling.createShape(subprocess, { x: 700, y: 100 }, mainProcess);
      subprocess.businessObject.name = content_label;
      modeling.updateProperties(subprocess, { name: content_label });
 return subprocess;
  }
  else{
    return false;
  }

  } catch (error) {
    console.error('Si è verificato un errore durante la creazione del sottoprocesso con processo interno:', error);
    return null;
  }
}

I’ve seen you created many questions, some with fairly bad quality. Please consider:

  • When you ask for our help, provide relevant context so we have a fair chance to help you.
  • Ensure you properly format your code snippets
  • If you want to demonstrate an end-to-end project you work on, consider setting up a code sandbox for that.

We’ll otherwise waste each others time.


Regarding this particular question:

is possible to “expand” the call activity to check the process inside?

You can expand an embedded sub-process as part of our tooling. You cannot expand a call activity as this lives outside of the current process diagram. If you want to accomplish that, then you’d first want to decide where / how you want to load the external process reference.

How can I set an external process (from a file .bpmn) as the calledElement of the callActivity?

How can I set an external process (from a file .bpmn) as the calledElement of the callActivity?

To do it you’d maintain the callActivity#calledElement property in the BPMN business object:

<callActivity id="callCheckCreditProcess" name="Check credit" calledElement="checkCreditProcess" />

Using bpmn-js there is a bunch of ways to do this: