Accessing Environment variables in the expression language

Hi all,

I’d like to be able to inject a value into my CMMN model via an environment variable. Is the expression language capable of accessing environment variables? I’ve been able to do this quite easily using a Javascript script block, but I’d like to avoid using that for my current use case.

Thanks in advance,

Hi Scott,

as far as I can see, right now you cannot have access to environment variables in el.


Is java an option?
Create a named java-bean and access the system variable via expression


{#myJava.getMySystemVars(someParameter - typically execution variable from process)}

example from Oracle:
and in method getMySystemVars -

I haven’t had the need to read system properties in a while - typically reading from application properties… So, this is just an example from Oracle’s java ref’

1 Like

Thanks for the replies everyone. I found a related question on the old forum yesterday, which I’ve used to come up with a solution.

I reconfigured the Business Process Engine to use a custom Expression Manager. This expression manager is configured with a CompositeELResolver, which is composed of the regular ELResolver and a custom one. The custom ELResolver simply implements the getValue() method by delegating to System.getenv() in the Java code. This allows us to access the environment variables in the expression language. The nice thing about this is that the Environment Variables are only consulted when the regular expression resolver fails to find a result.

Gary, we’re using Environment Variables to avoid having config stored in property files. It makes it easier for us to manage the config. We’re following the 12 Factor App guidelines in this regard.