Tutorials / Glossary / Sub-Process

Sub-Process

A self-contained group of elements nested inside a parent process, used to structure or reuse logic.

Sub-Process

A sub-process (drawn as a rounded rectangle with a small "+" that expands to reveal its own start event, flow, and end event) groups a set of steps as a single unit inside a larger process. It can have its own gateways and branches, and can attach boundary events that apply to the whole group.

Sub-processes are useful for keeping a large process diagram readable, and for scoping error handling — a boundary event on a sub-process catches errors from anything inside it.

Example

Bpmn.createProcess("onboarding")
  .startEvent("start")
  .subProcess("setup", (p) =>
    p.startEvent("sub-start")
      .serviceTask("create-account", { taskType: "create-account" })
      .serviceTask("provision", { taskType: "provision-access" })
      .endEvent("sub-end")
  )
  .endEvent("end")
  .withAutoLayout()
  .build();
Try it hands-on: Taming complexity with sub-processes →