if module exists then ... else ...

0
Is there any option to check if a module exists in an application? if module exists then use functionx from that module else use my own function Preferably more elegant than having the ‘other module’ expose an API, have my module attempt to call that API to see if it returns 200-OK or an error.
asked
5 answers
2

Hi Tim, 

Like Robert says you can with MxModelReflection. 

We have an ASU which checks if all the desired modules are available and synced, so we can cater to one-click deployment and not have to run (too many) additional actions. 

 

answered
2

If such a module is going to have any entity in the system, once possible check is to check through database

SELECT  count(*) FROM "PUBLIC"."mendixsystem$entity" where  entity_name like ‘ModuleName*’  (check the format, I am more of a SQL*Plus guy)

answered
1

That’s an interesting question, and I’m going to be interested to see what answers you get.

One idea that I’ve not tested: Could you use the MxReflection module? Look to see if the module exists there, and if it does call it using one of the execute microflow actions in Community Commons to call it by name? If it doesn’t exist, call your microflow instead.

answered
1

As others say, the reflection capabilities in Mendix could help. You could use the MxReflection module, or maybe more easily use the APIs it relies upon. You could write a Java action with:

Core.getAllMendixObjects() 

or

Core.getMicroflowNames()

and filter that to the one you’re looking for.

answered
0

An other view:

  • Check if the folder exists? Or a specific version file? Check can be done with Java or JavaScript
  • Eventually can you check and then fill a Boolean attribute for later use?
answered