How can I automatically set a version on a transition?

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?

2 answers

1 accepted

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;


VersionManager versionManager = ComponentAccessor.versionManager

IssueManager issueManager = ComponentAccessor.getIssueManager()

Issue issue = issue

Project project = issue.getProjectObject()

Version versionFX = versionManager.getVersion(project.getId(), "version")


issueManager.updateIssue(componentManager.jiraAuthenticationContext.getLoggedInUser(), issue, EventDispatchOption.DO_NOT_DISPATCH, false)

0 vote

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:,FixVersionsorComponents



Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

212 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you