How to fetch release date of a version using groovy script


My requirement is to fetch the release date of a version for an issue using groovy.

I am able to get version name (08.00.10D). Next, I tried couple of ways using "getFixVersionsFor" and "version.getReleaseDate()" method for fetching the release date, however, couldn't succeed.


Please help.


8 answers

1 accepted

So you have a custom field which holds a version (or a set of versions). Using issue.fixVersions will not work, because this returns the value of the system "Fix Versions" field, which you are not using - you have a custom field instead.

What you need to do is retrieve the value of the custom field and then call one of the methods on VersionManager to get the Version object. You can then call getReleaseDate() on that object. Which VersionManager method to call depends on what is stored as value of the custom field - there are appropriate methods for finding versions by id or by name.

Many thanks Petar. Your directions helped me in resolving the same.

Post you whole groovy script so we can answer your question. Generally the method you are looking for is Version.getReleaseDate() but since you say this does not work for you, there may be something else wrong.

Please find below the script...The section "HELP NEEDED HERE" is where I have to return the release date of the corresponding patch version. 

//Variable Declarations:START
def issue //To hold issue key-id
def customPatch//To hold custom field name as "Patch Version"
def patchValue //To store corresponding patch version value for an issue
//Variable Declarations:END
issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("ABCD")
//Fetching patch version:START
customPatch = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(12345)
//Fetching patch version:END
//Checking if patch version field is not null and fetching patch version value:START
if(customPatch != null) {
    patchValue = (String) issue.getCustomFieldValue(customPatch);
//Checking if patch version field is not null and fetching patch version value:END


What is wrong in this? It is returning "[]"

def date = new Date()
date = issue.fixVersions*.releaseDate

return date

Hi Petar,

Could you please help? I am stuck.




Let me get this straight - you have a custom field which holds a version? And you are not using the Fix Version system field for that?




In the above image, we are creating versions with a specific name and release date like we do it in standard way in JIRA. Next, issues in the projects are tagged to particular versions to track their release.

All, I need is to return the release date corresponding to the attached version for an issue to a custom field.

Please do let me know, if any more information is required.

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
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
Read article

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