Auto populate fix version when issue is resolved

Hi

I have a requirement on jira.

I want to be able to automatically populate the fix version(s) field with the next unreleased version when the issue is moved to resolved.

How can we achieve this?

Rahul

4 answers

1 accepted

Conditioned Workflow Functions for JIRA has a post function to update an issue and you can use the earliestUnreleasedVersion(projectKey) substitution variable to set the fix versions field.

1 vote
Tarun Sapra Community Champion Oct 29, 2013

You can write a Transition post function script for this using scriptRunner plugin.

If you've done this yourself could I see the script to copy it for myself please?!

The following sets it to a specific version based on the string passed when creating the Version... you should be able to modify this with the function Bob suggested to get what you're looking for.

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(), "no actual code")

issue.setFixVersions([versionFX])

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

In case, you might have multiple unreleased versions. How will you identify which one?

The following sets it to a specific version based on the string passed when creating the Version... you should be able to modify this with the function Bob suggested to get what you're looking for.

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(), "no actual code")

issue.setFixVersions([versionFX])

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

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,307 views 14 20
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot