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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.