This is an old revision of the document!
Post functions allow you to perform specific actions upon the transition. Following are some useful examples.
import com.atlassian.jira.component.ComponentAccessor def commentManager = ComponentAccessor.getCommentManager() def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() commentManager.create( issue, currentUser, "This is my comment", false)
import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.util.UserMessageUtil def versionManager = ComponentAccessor.getVersionManager() def projectManager = ComponentAccessor.getProjectManager() def project = projectManager.getProjectObjByKey(issue.projectObject.key) def versions = versionManager.getVersions(project) def firstUnreleasedFound = versions.find{! it.released} if (issue.fixVersions.size() == 0){ UserMessageUtil.success("I'm in the loop") if (firstUnreleasedFound) { issue.setFixVersions([firstUnreleasedFound]) issue.store() } else { UserMessageUtil.error("MANUAL INTERVENTION REQUIRED!!! No Unreleased Fix Version Found. Please add a Fix Version manually to this ticket....") } }