I am trying to create my first code / script in Script runner for Jira Cloud but I am 3 months in and not succeeded yet. (Obviously, I have little to no coding experience)
I have a workflow in a project and I am trying to create a post function that emails a specific user once an issue has passed through this transition (which happens to be an escalation transition from 'waiting for support' to 'Escalated'). I have a working code that currently posts the name of the person and the relevant comment but it isn't 'tagging' the user. So it doesn't send them a notification. Is anyone able to tell me what I am missing, below is my code which is running in the post function:
final JOE_BLOGGS_ACCOUNT_NAME = "JOE BLOGGS"
def issueKey = issue.key
def commentText = ${JOE_BLOGGS_ACCOUNT_NAME} this ticket has been Escalated."
def result = post("/rest/api/2/issue/${issueKey}/comment")
.header('Content-Type', 'application/json')
.body([
body: commentText
])
.asString()