Hi,
I have setup the ScriptRunner Escalation Services in Jira Cloud and managed to transition the issues for testing. I tried to search of code snippets for Jira Cloud to add comments, but am unable to find any.
I should use the REST API v3 endpoint /rest/api/3/issue/{issueIdOrKey}/comment but I'm not very familiar with ScriptRunner scripting yet, so I'm stuck here and would appreciate your help with formatting the body part of the code. Let me know if any part of the code is incorrect as well.
// 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)
// Check if the issue was transitioned correctly
// Log out the issues updated or which failed to update
if (result.status == 204) {
logger.info("The ${issue.key} issue was transitioned by the escalation service.")
// Write a comment in the issue transitioned
// /rest/api/3/issue/{issueIdOrKey}/comment
// NEED HELP WITH FORMATTING THE BODY
def resultComment = post("/rest/api/3/issue/${issue.key}/comment")
.header("Content-Type", "application/json")
.body([paragraph: [])
.asObject(Map)
Thanks and Best Regards,
Marianne