Configuration and Use of Constants

Last modified 01 Mar 2024 00:20 +01:00
Since 3.6
This functionality is available since version 3.6.


See Constants page for motivation and general introduction to the concept of constants.


The constants are defined in the midPoint configuration file (config.xml) in midPoint home directory:

            <orgName>Example, Inc.</orgName>

Instead of changing config.xml file you can set up the constants also as parameter or environment variables. For more information check the Start script docs page.

Example of the syntax:

  • the environment variable: MP_SET_midpoint_constants_orgName="Example, Inc."

  • the parameter : -Dmidpoint.constants.ldapHost=""

Use of Constants

Constants are usually used in expressions. There is a special const expression evaluator for easy use of the constants. For example a constant defined above may be easily used in the outbound mapping:


In that case every time the expression is evaluated it will produce a value defined in the config.xml file. In this case the value will be "Example, Inc." and that is what will be stored in the resource attribute. The same constant may be used at many places in the system. Which makes changing the value quite easy.

Constants are especially useful in resource configuration. However, prior to midPoint 3.6 it was not possible to use expressions in resource configuration. Since midPoint 3.6 this is perfectly possible. Therefore the constants can be easily used in resource configuration:


The constants are often used to compute a value, where the constant is just a part of the resulting value. In that case the const expression evaluator cannot be used. Therefore there is a getConst() library function that can be used in scripting expressions:

                    <code>'uid=' + name + ',' + midpoint.getConst('ldapBaseContext')</code>

Limitations and Future Extensions

There are few known limitations to this functionality in midPoint 3.6:

  • Constants are loaded only once at system startup. Currently there is no way how to refresh the values when the constants change except for system restart.

  • There is no support for these features in resource wizard. Resource wizard does not support expressions in resource configuration properties and it does not support const expression evaluator.

Future midPoint versions will probably introduce several alternative methods to specify constant values. One such method may be specification of constant values in system configuration object. If you are interested in this extension or you are affected by the current limitations then please consider a subscription.

Was this page helpful?
Thanks for your feedback