cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hopex V5 - Uploading a BPMN file via REST APIs

fakhouryy
MEGA Partner
MEGA Partner

Hello all,

Context:
We're currently trying to integrate MEGA with a process mining tool. The process mining tool is able to generate BPMN diagrams of the process variants, which can be exported in BPMN format, and imported to MEGA. The described exercise (exporting BPMN file from process mining tool and importing the BPMN file into Hopex) is currently done in a manual fashion. What we aim to do is automate the export/import aspect.

Our Approach:
We thought a good way to achieve the automation is to be able to simulate the "Import BPMN file" functionality of MEGA Hopex via REST APIs.

Problem:
Looking at the V5 API documentation the closest available API that we can use is the Attachement API (Upload). If we use this API, the BPMN would be imported as a Business Document object in MEGA. This API would not help in our case as no Organizational Process object would be created.

Questions:

  1. Is it technically possible to import a BPMN file via APIs in MEGA whereby an organizational process would be created along with it's process diagram?
  2. Assuming there are not such available APIs, how can we tackle this?

Any feedback/guidelines are highly appreciated!

4 Replies

Hello @fakhouryy 

OK great ! you've done the hardest part 🙂

You're correct about the macro, you'll need to do something like the sample code below

you need to :

- get the diagram and set the drawing to Read Write

- add the described object on the diagram - usually this is not the case in imported BPMN files and the macro needs it (here, we also add the participants in case they are not already on the diagram)

- apply the desired layout on the drawing

Sub OnWizTerminate(mwctxManager As MegaWizardContext)
Dim mgRoot : Set mgRoot = mwctxManager.GetRoot

Dim mgobjObject : Set mgobjObject = mgRoot.GetCollection("~gsUiU9B5iiR0[Process]").Item(mwctxManager.property("~H6XyIDlfabX9[ProcessID]"))
Dim mgobjDiagram : Set mgobjDiagram = mgRoot.GetCollection("~KekPBSs3iS10[Diagram]").Item(mwctxManager.property("~mdPEP05baXR1[ImportedDiagramID]"))

mgRoot.CurrentEnvironment.DesktopContext.CurrentObject mgobjObject

Dim mgTool
If mgobjDiagram.Exists() Then
Dim mgBPMNReorgButtonsMacro : Set mgBPMNReorgButtonsMacro = mgRoot.CurrentEnvironment.GetMacro("~Ar8v4MEXTfLD[BPMN Diagram Reorganization Buttons]")
Dim mgLayoutMacro : Set mgLayoutMacro = mgRoot.CurrentEnvironment.GetMacro("~V4wT2YdSM1TT[BpmnHorizontalLayout]")

Dim oDrawing : Set oDrawing = mgobjDiagram.Drawing("RW")

mgBPMNReorgButtonsMacro.AddDescribedObject mgRoot, oDrawing
AddParticipants mgobjObject, mgobjDiagram, oDrawing
mgLayoutMacro.OnLoadDrawing oDrawing
oDrawing.Flush

 

 

Hi Again @OLeGuellec, your insights were indeed very helpful!

We managed to create a custom web service with an HTTP listener to receive and process BPMN files sent from the mining tool via POST requests.
The only thing left to do now is automatically trigger the automatic layout on the diagram of the process.
I think I need to look at the "~V4wT2YdSM1TT[BpmnHorizontalLayout]" macro, but we're not able to know what are the required parameters to call it.

Any ideas?

Thanks a lot for the valuable feedback, sir!

What we're trying to achieve is indeed via a "push" mode, preferably via API by exposing the BPMN import function (as per your 1) a) suggestion).
 I will check for any guidelines pertaining to creating a custom web service and try some stuff out. If you have any specific sources for this, it would be much appreciated to share them as well 🙂 

OLeGuellec
MEGA
MEGA

Hi,

Interesting project !

The range of options would be :

1) in a "push" mode, i.e. the Process Mining tool calling HOPEX to push a process into HOPEX (this is what you seemed to have in mind)

a) build a custom web service exposing the BPMN import function available in the server API (see attached sample server side vbscript macro importing .bpmn from a folder)
b) alternatively, using the business doc import via the OOTB graphQL endpoint, and then have a scheduled macro importing these, using the same

2) in a "pull" mode, calling the Process Mining tool API from HOPEX to create a new process (this may be easier to implement, depending on the source tool provided API)

e.g. having a button allowing browse the Mining tool inventory, select and import a process into HOPEX