I'm trying to add a Post Function to a transition automatically set a Version Number on any issue that uses this transition. When I add a Post Function to the transition and use "Update Issue Field", Version is not listed as an option. It's not a dynamic Version number, it's just a static "No Version" value (for incoming support issues that did not require any code changes), so it seems like Script Runner would be overkill. How do I get Version to appear in that Post Function list?
This accomplished what we were looking for when added as a post-function on the transition.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.version.Version
import com.atlassian.jira.project.version.VersionManager
import com.atlassian.jira.event.type.EventDispatchOption
import org.apache.log4j.Category
Category log = log;
log.setLevel(org.apache.log4j.Level.DEBUG);
VersionManager versionManager = ComponentAccessor.versionManager
IssueManager issueManager = ComponentAccessor.getIssueManager()
Issue issue = issue
Project project = issue.getProjectObject()
Version versionFX = versionManager.getVersion(project.getId(), "version")
issue.setFixVersions([versionFX])
issueManager.updateIssue(componentManager.jiraAuthenticationContext.getLoggedInUser(), issue, EventDispatchOption.DO_NOT_DISPATCH, false)
Hi Shylah,
I don't think there is a easy way to achieve this other than by using Script Runner.
You may find the instructions on how to implement this with Script Runner in the link below:
https://jamieechlin.atlassian.net/wiki/display/GRV/Post+Functions#PostFunctions-SetAffectsVersions,FixVersionsorComponents
Cheers,
Danilo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.