I'm at my wits end. I've been fighting this all morning and can't figure it out. I'm getting the following error. For what it's worth, it works like a charm in the script console!
2019-08-30 16:09:07.529 ERROR - java.net.URISyntaxException: Illegal character in path at index 90: https://avst.connect.adaptavist.com/proxy-service/rest/api/1/jira/proxy/rest/api/2/issue/${issue.key}
2019-08-30 16:09:07.531 ERROR - Class: com.adaptavist.sr.cloud.workflow.RunScript, Config: [className:com.adaptavist.sr.cloud.workflow.RunScript, uuid:c8514b86-b940-4843-97bd-b79eebd340b8, description:devChange calculation, enabled:true, executionUser:ADD_ON, additionalCode:// get custom fieldsMy script fires on a workflow transition:
def customFieldName = 'customfield_13635'
def result = get("/rest/api/2/issue/${issue.key}?fields=${customFieldName}")
.header('Content-Type', 'application/json')
.asObject(Map)
def currentValue = result.body.fields[customFieldName] as Integer
def newValue = currentValue + 1
def newResult = put("/rest/api/2/issue/${issue.key}")
.queryString("overrideScreenSecurity", Boolean.TRUE)
.header('Content-Type', 'application/json')
.body([
fields:[
customfield_13635: newValue
]
])
.asString()