Created by
Joaquin Fernandez
| //Find and store the attachment names in a paragrahp custom field
def issueKey = 'NOT-1'
def result = get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
def filenames = result.body.fields.attachment.filename.join(", ")
def result2 = put('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.body([
fields:[
customfield_10079: filenames
]
])
.asString()
if (result2.status >= 200 && result2.status<300){
return filenames
} else {
return "Failed to update custom field with the attachment names"
}
|