Scripted date field issue

Esther Strom October 17, 2017

I'm trying to show the release date associated with a fix version on issues assigned to that fix version. I've created a scripted field, set it to the Absolute Date Time template, and added this script, based on the answer here. Oddly, if I set it to a text field, it does display a date. 

enableCache = {-> false}
def version = issue.getFixVersions()
if(version) {
return version.first().getReleaseDate().format("dd/MMM/yyy");
}
else {
return null;
}

 

I've also tried this

Date releaseDate = null
issue.fixVersions?.each{releaseDate = it.releaseDate}
return releaseDate

based on the answer here.

Regardless of which code I use, when I view an issue with a fixVersion set (either by using the Preview button, or actually saving the changes and opening an issue), instead of a date, this is what shows:

$datePickerFormatter.format($value)

What am I doing wrong? This is my first attempt at using scripted fields. If this isn't the purpose of the Absolute Date Time template, what is that used for?

 

We're on Jira 7.1.1 and ScriptRunner 5.0.11.

1 answer

0 votes
Thanos Batagiannis [Adaptavist]
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.
November 2, 2017

Hi Esther,

Can I ask you what kind of searcher you used for the scripted field ?

Searcher: Date Time Range picker
Template: Date Time Picker

And for the script try

enableCache = {-> false}
issue.getFixVersions() ? new Date(issue.getFixVersions().first().getReleaseDate().time) : null

Please let me know if this does the trick 

Regards, Thanos

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events