I have project with kanban board. When I release issue fixVersion field is updated.
But when i reopen released issue fixVersion field doesn't change so i don't see this issue on the board.
What is best way to update fixVersion field when transition happens? If it is no built-in way I have ScriptRunner on my Jira instance so could use it.
Hi @Andrey Glazkov,
You can use below script for updating fix version field in post-function
import com.atlassian.jira.component.ComponentAccessor
def versionManager = ComponentAccessor.getVersionManager()
def project = issue.getProjectObject()
def version = versionManager.getVersion(project.getId(), "version name")
if (version) {
issue.setFixVersions([version])
log.warn("${issue.key} - fix version/s has been updated with ${version}")
}
else{
log.warn("Version does not available")
}
BR,
Leo
Hello, Leo and thanks for response!
Apparently I expressed myself inaccurately. I needed to clean up fixVersion field when issue moved from Closed status to any other statuses.
Your solution is correct but too complex for my case. After some investigation I googled apropriate solution:
In Post-Function menu select "Script Post-Function [ScriptRunner]" then select "Custom script post-function".
Use this script for post-function:
import com.atlassian.jira.issue.MutableIssue;
MutableIssue issue = issue;
issue.setFixVersions(null);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey, I thought you wanted to change fix version. but if you want to remove fix version/s value is quite easy and simple. just single line code is enough
issue.setFixVersions([])
log.warn("${issue.key} - fix version/s has been updated")
BR,
Leo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Leo !
I tried
issue.setFixVersions([])
in our environment (Jira 8.8.1, SR6.0.1-p5) and get the following error:
Has there been a change in the API affecting how to clear FixVersions for an issue?
BR/Jonas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
my environment is 8.5.3 with 6.1.0 but no error
maybe you can give a try with below code
issue.setFixVersions(null)
BR,
Leo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finally found that 6.0.1 suffered from:
SRJIRA-4308 - The type of issue in post-function was incorrectly Issue and not MutableIssue.
This was solved in 6.1.0.
(The code you suggested was my original code version where I discovered the error mesage ... so it was of course a good and valid suggestion ;-) )
BR/Jonas
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.