It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner - Get Project Release Change History

Is it possible to get the change history of a project's releases using Scriptrunner? 

I want to iterate through all of my issues, look at each of the fix versions for each issue, find the fix version that was most recently modified and set each issue's due date equal to the Release date of the most recently modified fix version/release. 

Is this possible?

2 answers

0 votes

Hi @Jake Jollimore 

I don't have a handy script to give you at this moment but I believe it can be done.

You may want to take a look at this post here to get some pointers.


Thanks for the quick response. I had a look at the post you mentioned, but, unfortunately, it's not what I need. 

I need to check the date/time a version was modified (not it's start or release date values)in order to determine which version is 'most current'. 

0 votes

Ok you can find that in the change history. Take a look at this example.

Unfortunately, that's not what I need either. 


Here's my current script:


import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.bc.issue.IssueService.UpdateValidationResult
import com.atlassian.jira.bc.issue.IssueService.IssueResult
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.MutableIssue


def issue = event.issue as MutableIssue;

//Only do work if the Fix Version field has changed
if (event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Fix Version"}) { "The Review Type field has changed"
Date latestReleaseDate = null;

//Find the fix version with the latest date and store it in latestReleaseDate
if(fixVersion.releaseDate != null && (latestReleaseDate == null || latestReleaseDate.compareTo(fixVersion.releaseDate) < 0)){
latestReleaseDate = fixVersion.releaseDate

//If at least one valid release date was found, set the issue's due date to match.
if(latestReleaseDate != null){
IssueService issueService = ComponentAccessor.getIssueService()
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()

ApplicationUser loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

if (!loggedInUser) {
loggedInUser = UserManager.getUserByName('jira_bot')

UpdateValidationResult validationResult = issueService.validateUpdate(loggedInUser, issue.getId(), issueInputParameters)

if (validationResult.isValid()) {
IssueResult result = issueService.update(loggedInUser, validationResult)
} else { "ERROR: ${validationResult.getFieldValuesHolder()} : ${validationResult.getErrorCollection()}"

This script runs when the Fix Versions field changes for an issue, and sets the issue's Due Date field to the latest Release Date among its fix versions.

What I need to do is check which Fix Version (or Release) was most recently modified by a user. That is to say, I'm not interested in how the Fix Version field values changed for a given issue, I'm concerned with when the actual Releases listed in the Fix Versions field were modified (had their name, release date, start date, etc. changed). Whichever one was modified most recently, I want to set my issue's due date to it's Release Date value. 

I'm beginning to think this isn't possible, though I hope I'm wrong. What I'm looking for is some kind of value like 


Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you