We're using the following script (in a Listener) to update a custom field ("Last Comment") with the last comment on the issue. This is to make it searchable with jql and pull into reporting. It works, except it also sends an email out when it does the issue update.
Is there a way to suppress that notification email?
The script:
final lastCommentFieldName = 'Last Comment'
// Get last comment custom field id
def customFields = get("/rest/api/2/field")
.asObject(List)
.body
.findAll { (it as Map).custom } as List<Map>
def lastCommentCfId = customFields.find { it.name == lastCommentFieldName }?.id
// Updates the issue with the created comment body
put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.body([
fields:[
(lastCommentCfId): comment.body
]
])
.asString()