‎08-03-2024 12:35 PM
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:
Any feedback/guidelines are highly appreciated!
‎14-03-2024 03:43 PM
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
‎14-03-2024 02:34 PM
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?
‎08-03-2024 06:52 PM
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 🙂
‎08-03-2024 06:19 PM
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