Handling Processes and Tasks


#1

Hi?
I need to handle processes and each process tasks.
I want to start a process and execute the process tasks one by one.
I am using Node js. Please, help!


#2

@YoungLinkar
Hi,
What’s your means? if you want execute designed bpmn diagram you need a engine, for example you can use camunda process engine for free or implement custom process engine.

What you need exactly?


#3

Thanks for answering!

for instance, I have:
const xmlString =some xml string from .bpmn file

I want to loop xmlString to know what is the process involved. on the other hand, once I know the process, i want also to loop the tasks and the sequenceFlows inside that process. I dont know i am enough clear!
Thanks on advance


#4

Have you made yourself familiar with our toolkit? What did you try already and where did you get stuck?


#5

I am following this repository https://github.com/bpmn-io/bpmn-js
There are many examples, but how to make a simple forEach inside the root Elements, I didnt see! Sorry if there is. But I need help


#6

Sir I have found the answer here: https://forum.bpmn.io/t/can-i-use-bpmn-js-to-parse-an-bpmn-file-for-its-tasks/1254/4
Now, could you tell me please how to work with a gateway?


#7

Can you maybe explain a little more in detail what you want to achieve + what you already did? Some code would be helpful.

As the forum thread you posted reveals, it’s possible to iterate over all elements with the ElementRegistry component. Since I don’t know what you want to do with gateway elements, it’s hard to help you. You could modify the posted to detect Gateway elements:

elementRegistry.forEach(function(elem, gfx) {
  if (elem.businessObject.$instanceOf('bpmn:Gateway')){
   // do stuff
  }
});