Groovy variables enable more complex mapping of data. It could be that status or date needs to be mapped to other values.
Available scopes
The groovy script has the following objects / variables available
Variable name | Description | Note | ||
---|---|---|---|---|
issue | the current issue that the call is operating on | |||
response | the parent response from the previous runned call as String | |||
jsonSlurper | Does not work with Groovy 3.0.7 and OpenJDK 64bit 11.0.13+8 (https://issues.apache.org/jira/browse/GROOVY-9802 ) | |||
jsonOutput | Does not work with Groovy 3.0.7 and OpenJDK 64bit 11.0.13+8 (https://issues.apache.org/jira/browse/GROOVY-9802 ) | |||
scope | all previous defined variables or responses Example if call A get then call C and c wants to access name it can do so by using
|
Common Error
Exception in your groovy code java.lang.RuntimeException: Unable to load FastStringService
Workaround
Workaround is to use ObjectMapper instead of JSON Slurper
Parse JSON
Code Block | ||
---|---|---|
| ||
import com.fasterxml.jackson.databind.ObjectMapper
ObjectMapper mapper = new ObjectMapper()
//response is passed in from the parent action
def myRespnse = mapper.readValue(response, HashMap.class) |
Produce JSON
Code Block | ||
---|---|---|
| ||
def myList = []
myList.add([email:issue.reporter.emailAddress])
return mapper.writeValueAsString(myList) |
See examples
Page Tree | ||
---|---|---|
|