Sprint Date Custom field

Is it possible to create custom field called "Sprint Date Add" that will update automatically a date field based on the change in value of a sprint field.

Example: Issue created on 05/20/2016. Added to a sprint on 6/2/2016. 

Sprint date add would then give a date value 06/02/2016.


This would be run for reporting purposes by a team that wants to know when an issue was exactly added to a sprint rather then checking the history tab of each issue. They want to be able to run a JQL and could use the Sprint Date Add to run a query based on that. It would visually also be good for reporting.

1 answer

Hi Davor,

I have attached an example of how you can create a Scripted Field called Sprint Dates which will show for an issue what the Start and End dates for the sprint are.

I have attached below the code and config for the Scripted Field along with a screenshot of what the output on an issue looks like.


// Required Imports
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import java.text.SimpleDateFormat;
import java.util.Date.*;

// Get the current issue key
Issue issue = issue

// Get a pointer to the CustomFieldManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()

// Get a pointer to the sprint CF
def sprintCf = customFieldManager.getCustomFieldObjectByName("Sprint")

// Stop the values on screen showing old cached values
enableCache = {-> false}

// Define a new Java Simple Date Format
SimpleDateFormat sdfDate = new SimpleDateFormat("dd/MMM/YYYY");

// Get the Start and End dates for the sprint
Date startDate = issue.getCustomFieldValue(sprintCf)?.startDate?.first()?.toDate()
Date endDate = issue.getCustomFieldValue(sprintCf)?.endDate?.first()?.toDate()

// Format the dates with the Java Simple Date format defined
def formattedstartDate = sdfDate.format(startDate)
def formattedendDate = sdfDate.format(endDate)

// Construct the output String to be returned
String dates = "The Sprint Start Date is: " + formattedstartDate + "<br/>" + "The Sprint End Date is: " + formattedendDate

// Return the output String
return dates


image2016-6-7 11:13:3.png


image2016-6-7 11:13:27.png

I hope this helps.



Hi Kristian,


I am actually looking for a field that will show the date when the issue was added to the sprint. This would help on reporting on issues which are added after the sprint has started.

When I try this with live issues that have been in more than one Sprint, I get the wrong dates.

e.g. for an issue now in Sprint 3, using

“endDate = issue.getCustomFieldValue(sprintCf)?.endDate?.first()?.toDate()”


gives me the end date of Sprint 1


Changing it to:

“endDate = issue.getCustomFieldValue(sprintCf)?.endDate?.last()?.toDate()”


gives me the end date Sprint 2


Any idea what syntax I need to get the end date of the current sprint (Sprint 3)?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,949 views 19 22
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