Mendix action trigger reflection

I was wondering whether it is possible to write a java action that can 'read' all the action triggers that are used in an application. We are looking for a way to enable the user to assign workflowdefinitions to certain triggers (e.g. 'start new employee workflow') without creating a 'hardcoded' link between the button and the workflowdefintion. The same goes for 'help functionality' where you would like to assign certain predefined helptexts and assign them to information buttons in the application
1 answers

Sounds interesting!

It is not possible to access action triggers from Java. However, you can assign a microflow to each action trigger which executes another microflow (via Java) based on a microflow name retrieved from a configuration object. In this way you can configure the connections between action triggers and microflows at runtime!

In more detail:

  • Add an action trigger widget to your form.
  • Connect it to a microflow.
  • Add a retrieve activity in this microflow retrieving a configuration object with a String attribute containing the name of a microflow.
  • Add a Java action activity. Use the microflow name as input and execute that microflow using Core.execute(microflow name, ...).

By changing the configuration object in the web client you can change the microflow which is executed when clicking the action trigger. At runtime!