Use of constants

1
Cannot find my previous question on constants, answered by Ronald, so herewith the question I still have. I have several microflow's that get a specific record with code 'INI' stored in one of its fields. I want to create a constant with value 'INI' to make it more easy to maintain. The value is independent of the environment. Then I would like to use this constant in the microflows just like a variable. How?
asked
3 answers
1

Constants are used to define values that can be different in different configurations (development, test, acceptation and production). Constants can be used in a microflow expression by prefixing the full name of the constant with @.

answered
1

There is not really an option for an application global variable.

You'll have to choose:

  • constants (which could be set differently per environment)
  • hardcoding it in every place you use it
  • using a global Settings objects where it can be set (if it needs to be adjustable at runtime)
  • Or what I suggest you do, is to make a microflow that returns a string and have it hardcoded there, and call that microflow whenever you need it. That way you have it hardcoded but can still easily change it without having to set it in a thousand different places.
answered
0

We use constants a lot, also for values that are fixed for all environments. The value you assign in the modeler will be used as default during application deployment. So just don't change the value during deployment. And indicate in the documentation that the value should not be changed.

It would be nice to have a flag on a constant indicating whether the value may vary between environments.

answered