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

This widget could not be displayed.

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.

This widget could not be displayed.
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)

This widget could not be displayed.

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

This widget could not be displayed.

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 Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

215 views 3 0
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