HOW GET BPMN Get the previous steps

i want get the previous steps .i want get click step4 show list from name and id activitiy step1,2,3 or console.log
and with id step4 get the previous steps

You can find connected elements via the outgoing & incoming properties of any element.

const eventBus = modeler.get("eventBus");

eventBus.on("", function (event) {
  const { element } = event;

  console.log("element clicked:", element);
  console.log("element id + name:",,;
  console.log("incoming (before):", element.incoming);
  console.log("outgoing (after):", element.outgoing);

This way you can go along the chain and potentially find those elements.

Source: element incoming outgoing - CodeSandbox