Evaluates a Groovy script and injects the results into the environment. This script s powered by the Script Security Plugin; both Approved Script and Groovy Sandbox modes are available. For the new scripts it is recommended to use the Sandbox mode.
The groovy script must return a Map<String,String>
Java object.
You can access parameters and other environment variables through variables in the Groovy script.
In the scripts you can also use the following variables.
currentListener
instead of this variable when possible.
All listed variables can be used in both script modes. In the Sandbox mode the access to particular fields and methods may require an additional approval.
For example, the Groovy can compute environment variables from user input parameters.
The script below injects the COMPUTE_VAR
environment variable according the CASE parameter value.
def stringValue="StRinG";
if ("upper".equals(CASE)){
def map = [COMPUTE_VAR: stringValue.toUpperCase()]
return map
} else if ("lower".equals(CASE)){
def map = [COMPUTE_VAR: stringValue.toLowerCase()]
return map
} else {
return null;
}