I am trying to create a scripted post-function to update the summary by adding a PREFIX and a SUFFIX to the original summary.
By navigating through some other posts I got to this code:
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
IssueManager im = ComponentAccessor.getIssueManager()
MutableIssue currentIssue = im.getIssueObject(issue.key) as MutableIssue
ApplicationUser loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def originalSummary = currentIssue.getSummary()
def newSummary = "PREFIX" + "-" + originalSummary + "-" + "SUFFIX"
currentIssue.setSummary(newSummary)
im.updateIssue(loggedInUser, currentIssue, EventDispatchOption.DO_NOT_DISPATCH, false)
when I test it in the "Scripted (Groovy) Operation on Issue Post-function" it seems to work fine as it actually changes the summary.
but when I try the transition, the Summary field shows to be updated in the issue's history but the actual Summary of the issue remains unchanged.
Does anyone know what I might be doing wrong here?