Creating Global Variables in Mendix for Use Throughout an Application

0
I am currently developing an application in Mendix and am looking for the best way to manage configuration values that can be used in various parts of the application, similar to constants. I would like these values to be dynamic, meaning I can change them without needing to redeploy the application, but also globally accessible to avoid repeating retrieve operations wherever they are used. I have been searching for a way to achieve this through standard Mendix mechanisms, but from what I understand, constants are set at design time and cannot be modified during application runtime, and data stored in entities requires a retrieve operation every time we want to use them. Has anyone faced a similar challenge and found a way to create global variables or configuration parameters that can be easily accessed and modified throughout an application? Is there a recommended practice or design pattern in Mendix that I could utilize for managing such data? I would greatly appreciate any suggestions, use case examples, or pointers to possible solutions.
asked
1 answers
0

You can make an entity ApplicationSettings in the Domain model where you can store all your global variables. With a GetOrCreate microflow (Singleton) you can retrieve de settings from the database where ever you need it. The microflow has to get the first entity from the ApplicationSettings list. If it does not exists then create it. 

With a configuration page you can set te values you need in the ApplicationSettings entity as a technical administrator. When there is a change you can do that while the application is running so you don't need to restart the application.

answered