I am trying to auto-populate "Summary" field based on other custom field values data. I have written the following script.
def issueKey = issue.key
def fields = get('/rest/api/2/field')
.asObject(List)
.body as List<Map>
def cf1 = fields.find { it.name == 'AJW Location' }.id as String
def cfv1 = (issue.fields[cf1] as Map)?.value
def cf2 = fields.find { it.name == 'AJW Area' }.id as String
def cfv2 = (issue.fields[cf2] as Map)?.value
def cf3 = fields.find { it.name == 'A/C Quantity' }.id as String
def cfv3 = (issue.fields[cf3] as Map)?.value
def cfv4 = cfv1 + cfv2 + cfv3
def result = put("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')
.body([
fields: [
summary: cfv4
]
])
.asString()
if (result.status == 204) { (6)
return 'Success'
} else {
return "${result.status}: ${result.body}"
}
I am getting following error.
2019-08-19 03:37:40.784 INFO - Serializing object into 'interface java.util.List'
2019-08-19 03:37:40.794 INFO - GET /rest/api/2/field asObject Request Duration: 877ms
2019-08-19 03:37:40.818 ERROR - No signature of method: java.lang.Double.get() is applicable for argument types: (java.lang.String) values: [value]
Possible solutions: getAt(java.lang.String), grep(), next(), grep(java.lang.Object), wait(), abs() on line 14
2019-08-19 03:37:40.853 ERROR - Class: com.adaptavist.sr.cloud.events.WebhookExecution, Config: null
I have configured it as Script Listener for events Issue Created and Issue Updated. It is in Atlassian Cloud.