How to detect FixVersion changes

Ahmet Faruk May 31, 2018

Hi all,

How can I check if a fixVersions value was changed or removed. ie. My fixVersions is "v1.0" and the user  removed. I'm use scriptrunner for JIRA ny Adaptavist.

I tried that like below but i saw same value.

def originalIssue = issueManager.getIssueObject(issue.id)

if(issue.fixVersions[0]?.name != orginalIssue.fixVersions[0]?.name){

// My expected is issue.fixVersions[0]?.name value be empty and originalIssue.fixVersions[0]?.name value be old value

}

 

3 answers

3 votes
EzraARA
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2018

 

Good day, Ahmet!

I am not quite sure if you are doing this for reporting purposes (and you want to run it manually) or automation purposes, but I just want to share that our JQL has an operator to check if Fix Version was changed:

- Advanced searching - operators reference - Atlassian Documentation - CHANGED

 This operator can be used with the Fix Version field, and  is used to find issues that have a value that had changed for the specified field.

Hopefully this could be of some help for you :)

Cheers,
Ezra ARA | Atlassian Cloud

Bappaditya Roy February 4, 2020

This was helpful.

ramonde zrihen March 15, 2020

@EzraARA : Hi Ezra, what about affected Version for JIRA Server 8.3 and higher ?

sdua December 2, 2020

I am trying to do the same as suggested by you for fixversion but I am not seeing any data. JQL below

 

fixVersion changed FROM "Version1" TO "Version2" order by created DESC

 

We are on Jira Cloud 

Like Devin Haynes likes this
1 vote
sdua December 2, 2020

@EzraARA : I am trying to do the same as suggested by you for fixversion but I am not seeing any data. JQL below

 

fixVersion changed FROM "Version1" TO "Version2" order by created DESC

Alexander Bondarev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2023

Thanks!

Keshav Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 19, 2023

@sdua 

Were you able to solve the above issue? What is the correct query to check if the fix version is changed from one value to another?

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2018

Hello,

Is a post function or validator? If it is a post function, then it must be first in the list of post functions

Ahmet Faruk May 31, 2018

is it like this? it does not work.

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()

def changeItems = changeHistoryManager.getChangeHistories(issue)

if (changeItems) {
  def changeItem = changeItems.last().getIssue().fixVersions[0]?.name

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2018

What does not work? Do you want to get a value from the history? Try to log the changeItems and see what is in the varaible

log.error("change items: " + changeItems.toString())

You can see the output in the atlassian-jira.log file

Suggest an answer

Log in or Sign up to answer