Calculated Date Field for end date of active sprint or release date of fix version


Our resources are active in a variaty of projects that use different approaches for planning in JIRA. Some use JIRA Agile for sprint planning, others mainly use Fix Versions and work towards the release date of a version and others  only use the due date of an issue. Although streamlining the planning approach would be the more logical solution, due to the nature of some projects this could not be achieved. 

Therefor, to consolidate "due dates", I would like to have a calculated date field that returns something as the following:

IF duedate is not EMPTY THEN calc.field = duedate
ELSE IF Sprint is not EMPTY THEN calc.field = sprint End Date (closest end date if issue appears in multiple sprints)
ELSE IF Fix Version/s is not EMPTY THEN calc.field = Version Release Date (closest release date if issue appears in multiple versions)
ELSE calc.field = ""

Besides some VBA stuff, I have no programming experience, so any input is welcome!






1 answer

Hello Wouter

You will propably need to implement a JIRA custom field plugin. You don't have to be an elite hacker to achive this however.

First step to get started would be setting up the environment and creating an empty plugin.

In that plugin you might want to implement your own calculated custom field of type Date, which is doing the calculations before returning a value.

Without to much programming experience i suggest using the atlassian plugin SDK tool to generate and wire up an empty plugin and your custom field. From there it's just as simple as translating your pseudocode in java and drop it in the right place.




Hello Alexej, The plugin I'm using is called "JIRA Misc Custom Fields". I have implemented allready a few other custom calculated fields with the support of Innovalog. I was hoping the "Calculated Date" field could be used for my request, but I don't know how to get it to display the required information. Thanks, Wouter

Ah i see. Using JIRA Misc Custom Fields is also a possible approach. I was not aware of this plugin yet, but i think i understand how it works. Basically it adds some extra custom fields which can be provided with a calculation formula. Yes, this should be sufficient in your case. So your Problem is about the formula right? lets see what the Documentation says. Formula syntax The formula should be included in the field description inside an html comment (so that it remains invisible when showing the field description), preceded by the following keyword: @@Formula: (note the colon at the end). For example: This field represents 10 days after the creation of the issue. <!-- @@Formula: org.apache.commons.lang.time.DateUtils.addDays(issue.get("created"),10) --> now we need to translate your pseudocode into java lets clear some things. what does this mean? calc.field = sprint End Date (closest end date if issue appears in multiple sprints) does it mean, that sprint End Date is another calculated custom field, which provides value as described in braces? Or does it mean that the sprint End Date has to be calculated as described in braces?

Hello Alexej, sprint End Date is a property of a started sprint in Jira Agile. An issue can appear in multiple sprints, so if that is the case, I need to have the End Date of the sprint that is scheduled to finish first.

You must excuse me, i didn't have a chance to work with JIRA Agile yet, but i have some basic imaginations. So, if i get you right, you must calculate the next Sprint End Date first, it is not just a field that can give you that value right away... This makes the formula way more complicated for you indeed. I would suggest to split your pseudocode in smaller parts, try them one by one and then join them into combined formula. lets start with first case IF duedate is not EMPTY THEN calc.field = duedate So we have a condition based on wether duedate is empty or not. And if there is a duedate, then we take its value for our field. something like this maybe: <!-- @@Formula: (issue.get("duedate") != null ? issue.get("duedate") : null ) --> explaining: this is short style if statement. condition is before question mark. then clause is between ? and : else clause is after : we get the value of the due date field and check if it is null or not. if not, we return the value of duedate field. else, we return null. please try this and report if it worked.

Hello Alexei,

It's been a while, I hope your still there.

I have picked up this topic again. The formula you entered helped me, next step is to include the check for a fix version:

<!-- @@Formula: (issue.get("versions") != "None" ? issue.get("duedate") : issue.get("userReleaseDate")) --> 

3 issuez with my above formula:

1) No matter what the value for the issue version is ("None" if no version is selected or the selected version) it always returns the due date. Same result when I use "null".

2) The due date is not in my "outlookdate format"

3) I'm not using the appropriate field for getting the "Release Date" of the Version

Any suggestions would be greatly appreciated.

Thank you,



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...

182 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