Hi
using below code in scriptrunner, I'm able to transition issue but unable to add comment simultaneously.
Seems syntax issue when I'm using ".body comment"
def issueKey = issue.key
def transitionID = '381'
// The rest call to transition the issue
def result = post("/rest/api/2/issue/${issue.key}/transitions")
.header("Content-Type", "application/json")
.body([transition: [id: transitionID]])
.asObject(Map)
if (result.status == 204) {
logger.info("The ${issue.key} issue was transitioned by the escalation service.")
} else {
logger.warn("The escalation service failed to transition the ${issue.key}issue. ${result.status}: ${result.body}")
}
// Add a return message to show which issues the escalation service ran on.
return "Escalation Service completed on ${issue.key}"
You can make it by additional action in script
def comment = """TEST COMMENT TEXT"""
def addComment = post("/rest/servicedeskapi/request/${issue.key}/comment")
.header('Content-Type', 'application/json')
.body([
body: comment,
])
.asObject(Map)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.