Contact Free trial Login


envVar(String): String | Null

Returns an environment variable with the specified name or null if the environment variable is not defined.


Name Description


Provides the name of the environment variable.


This example returns a Mac command console (SHELL) path and returns null on FAKE_ENV_VAR (an undefined environment variable). SHELL is one of the standard Mac environment variables. Also notice that the import command enables you to call the function without prepending the module name to it.


%dw 2.0
import * from dw::System
output application/json
    "envVars" : [
       "real" : envVar("SHELL"),
       "fake" : envVar("FAKE_ENV_VAR")


"envVars": [
    "real": "/bin/bash"
    "fake": null

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.