Misc Custom Fields - Display version release date in issue

Gregory Demotchkine December 4, 2013

I've read the documentation, but I haven't found the syntax for the formule to display the fixversion release date for the issue. Is this possible with this plugin ?

(I will enforce only one fixversion for the issues)

5 answers

1 accepted

2 votes
Answer accepted
David _old account_
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.
December 8, 2013

Ok, the correct (and tested) formula is:

<!-- @@Formula: 
Collection versions = issueObject.getFixVersions();
if (versions==null || versions.size()!=1)
  return null;

version = versions.iterator().next();
return version.getReleaseDate(); 
-->

 

 

Gregory Demotchkine December 8, 2013

David, thanks a lot! it works great, however it displays only: "in 4 months"

Can we force it to display the real date ?

Also if you could get chance, could you take a look at my other question ?

https://answers.atlassian.com/questions/240342/how-to-copy-the-sprint-name-into-another-field

Gary Fitzgerald May 17, 2018

I know this is an old but I tried the formula above and the field is not getting shown on the screen where it's supposed to be.

Does this formula work with latest Misc Custom Fields and Jira Server 7.8?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 17, 2018

Yes, it does. However, I had to update my initial response because the code what somewhat garbled by the conversion from answers.atlassian.com to community.atlassian.com.

Also, note that it only works if you have a single fix version on your issue.

Gary Fitzgerald May 18, 2018

Hi David,

Works great thanks!

Gary Fitzgerald May 18, 2018

Hi David,

Another question, how can I also get the Release Start Date?

Gary Fitzgerald May 18, 2018

Hi David,

Got it working with:

version.getStartDate(); 

It does have to be capitalized as shown.

Thanks again.

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 18, 2018

[Sorry, missed the previous posts. Disregard this answer that I can't delete]

Hi Gary,

start date and release date are two different things though.

Casey Maynard May 14, 2019

Where in JIRA do I enter these, so that I can set my Due Date to auto-populate from my Fix Version release date?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 14, 2019

Hi Casey,

That's a very different type of requirement, one that would be implemented using a workflow post-function such as JMWE's Set Field Value post-function. 

Like Casey Maynard likes this
1 vote
David _old account_
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.
December 5, 2013

Although I can't test it right now, I'd say you could create a Customer Date/Time Field with the following formula:

Collection&lt;Version&gt; versions = issueObject.getFixVersions();
if (versions==null || versions.size()!=1)
    return null;
Version version = versions.iterator().next();
return version.getReleaseDate();

Gregory Demotchkine December 5, 2013

Thanks David, I've tried running your suggestion using the Misc Custom Date/Time

<!-- @@Formula: Collection<Version> versions = issueObject.getFixVersions();

if (versions==null || versions.size()!=1)

return null;

Version version = versions.iterator().next();

return version.getReleaseDate(); -->

My field is not getting shown on the screen where it's supposed to be.

David _old account_
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.
December 5, 2013

Look inside atlassian-jira.log for errors. (look for com.innovalog.jmcf)

Gregory Demotchkine December 5, 2013

[innovalog.jmcf.fields.CalculatedDateField] CalculatedDateField: error evaluating formula: Parse error at line 1, column 31. Encountered: =

David _old account_
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.
December 5, 2013

It's probably because of "Collection<Version>". Try replacing that with just "Collection".

Ron L August 14, 2017

Hi David, the method you suggested works great, but I'm running into an issue with re-indexing when the Release Date value is updated on the Version.

Currently, if I update the Release Date value on the version it's not re-indexed until I manually update the issues linked to the release.  Is there anyway to get the ticket re-indexed when the Release Date value is changed?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 14, 2017

Unfortunately, that's a limitation of JIRA - there is no mechanism in place to track dependencies between fields and the objects they depend on. Also, there is no way to run code when a version object is updated. 

However, you could try automating a full reindex every night for example. 

David 

0 votes
dfinlay587 September 30, 2019

Humming along for a few years, then hit the issue with Multiple FixVersions for a given Issue.  Modified the Customer Field (JMCF) to handle:

  • If any of FixVersions are in the future,  then it will show the Next Release.
  • If all FixVersions are in the past,  it will show the oldest release.

 

Collection JIRAversions = issueObject.getFixVersions();

 

if (JIRAversions==null)

  return null;

Date TodaysDate = new Date();

Date SaveDate = null;

Date PullDate = null;

Iterator iter = JIRAversions.iterator();

 

//  Release date is the Next Release Date.  Once all Releases are past,  then it is the oldest date.

 

while (iter.hasNext()) {

 

  version = iter.next();

 

  PullDate = version.getReleaseDate();

 

  if (!(PullDate == null))

  {

    if (SaveDate == null)

                SaveDate = PullDate;

    if (PullDate < SaveDate && SaveDate < TodaysDate)

                SaveDate = PullDate;

    if(PullDate > TodaysDate && PullDate > SaveDate && SaveDate < TodaysDate)

                SaveDate = PullDate;

 

  }

 

}

 

if (SaveDate==null)

return null;

 

// The next part is so I can set the Release Date to 5pm. 

 

Calendar cl = Calendar. getInstance();

 

cl.setTime(SaveDate);

   

cl.add(Calendar.HOUR,17); //Set to 5pm

 

JiraReleaseDate = cl.getTime();

 

return JiraReleaseDate;

0 votes
David _old account_
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.
December 8, 2013

Unfortunately, the date is displayed using JIRA's default settings.

If you want custom formatting, you need to create a Text field instead - but of course this won't be searcheable or sortable as a string then...

I believe I could make an improvement to the calculated Date/Time fields to support selecting a different formatting option (I'll need to chek though), but this would require some work. Can you post an enhnacement request on our JIRA?

caguilar187 NA December 16, 2014

David Fischer I saw that this was resolved in https://innovalog.atlassian.net/browse/JMCF-102. I have version 1.5.11 of the plugin which I believe to be the latest but the <!-- @@Format: DATE --> isn't working for me. Wasn't able to comment in the jira project sorry for putting it here.

David _old account_
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.
December 16, 2014

Well, you're not giving me much to work from... Any error in the logs (atlassian-jira.log) right after you try to display an issue that has your field?

caguilar187 NA December 19, 2014

Sadly none that are in regards to this problem, I have a few errors showing in the log but they are related to the custom text fields, which I expect them to show up currently. My jira version is currently 6.1.6

David _old account_
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.
December 19, 2014

Can you share your definition ("Description") of the custom field?

caguilar187 NA December 19, 2014

<!-- @@Formula: date = issue.get("customfield_11032"); num = issue.get("customfield_11031").intValue(); org.apache.commons.lang.time.DateUtils.addWeeks(date,num); --> <!-- @@Format: DATE -->

David _old account_
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.
December 19, 2014

Unfortunately, you are right. This is due to an "improvement" in JIRA 6, that displays dates "smartly". For example, it will display "just now" for a date that represents now, but it will automatically update (without any user action) every minute, to display "one minute ago" a minute later. You should create a new issue on our issue tracker: https://innovalog.atlassian.net so that you can track its resolution, and I will try to fix it in the next release.

David _old account_
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.
December 21, 2014
caguilar187 NA December 21, 2014

thanks hadn't gotten around to it yet

0 votes
mwarton
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.
December 8, 2013

Hi Gregory,

I can't help with displaying it on the issue page in JIRA, but if you only need it in a report on the issue, check out Intelligent Reports. It can easily show any aspect of the version in a report on the issue. Best of all it's quick and simple, design your template in Microsoft Word, and set up simple point and click rules to fill in the data - no programming language or API to learn.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events