Constants are used to define configuration values that can differ per environment. When running the application locally or in a sandbox, the values as defined in the Modeler are used. When running the application on a production environment such as the Mendix Cloud, the values should be configured separately in that environment.
The value for a constant can be overridden in a Configuration. This allows you to run locally using different values for one or more constants, without having to change the default value for the constant every time.
Constants can be used in:
- Microflow expressions: by prefixing the full name of the constant with @.
- Consumed Web Services: in this case the constant is a URL that specifies where the web service is located. This can vary based on the environment in which the application is running, so that you can for example use different web services for development and production.
The name of the constant. This name is used to refer to it.
This field is for documentation purpose only: end users will never see it, and it doesn’t influence the behavior of your application.
The data type of the constant. This determines what kind of values a constant can hold. Supported data types are String, Boolean, Date and time, Float (deprecated), Decimal and Integer/Long.
The default value of the constant. This value is used when running locally or in a sandbox. When running locally, the value can be overridden in the currently selected Configuration.