Import subprocesses

Prior to v9 of bpmn-js it wasn’t possible to drill down into subprocesses (Drill Down into Collapsed Sub-Processes | Blog | My workaround was to model the details of subprocess in dedicated process models. I assume others did also do so.

The question that I have now: can we import such models for subprocesses and include them into the main process model?

Potential solutions could answer these more specific questions:

  • Is there something similar to importXML that can parse the XML of a subprocess model and insert it into a main process with a collapsed subporocess?
  • Is it possible to do some kind of copy and paste from separate instances of the modeller?
  • Is there any external script allowing to merge process models (that connect the subprocesses appropriately)?

Many thanks for any suggestion!

There is no such API at the moment. :frowning_face:

This is possible using the Camunda Modeler. :slightly_smiling_face:


There is no such tool at the moment. :frowning_face:

Many thanks for your reply. If you say it is possible with the “Camunda Modeler”, then it doesn’t apply to plain bpmn-js, right?

With I figured out that I can load a subprocess model, select all and copy, load the main process, open the subprocess plane and paste the copied subprocess. I was wondering what it would take to create such a functionality porogrammatically. This would probably involve these steps:

function importSubProcessXML( subprocess, xml ) {
   // create new instance of modeller
  var subProcessModeler = new BpmnModeler({
    // ...
   subProcessModeler.importXML( xml );

   // select all and copy
   // how can this be done?

   // get subProcess plane from main modeler
   const subProcessPlaneElement = elementRegistry.get(`${}_plane`);

   // paste everything copied into subProcessPlaneElement
   // how can this be done?

Does that make sense? Do you have any suggestion how to fill the gaps?

P.S. The reason why I am interested in such a solution is that it would ease handling of custom subprocesses as discussed here: Programmatically populate collapsed subprocess - #2 by rajgoel

@rajgoel Could you open an issue regarding this in bpmn-js? Happy to have it and await further feedback.

We don’t support this via API yet, and I don’t have an immediate suggestion how to fix it.

Opening two diagrams in parallel you can re-use the clipboard between these instances to copy and paste via the existing copy paste APIs. That would be a direction I’d pursue.

Created a feature request at Import details of collapsed subprocesses · Issue #1641 · bpmn-io/bpmn-js · GitHub

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