It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scripted date field issue Edited

Esther Strom Oct 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] Community Leader Nov 02, 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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Marketplace Apps & Integrations

Demo Den Ep. 4: Continuous Integration with CircleCI & Jira Software

Get ready! Demo Den Episode 4 is coming your way on Tuesday, May 28, 2018 with a Continuous Integration and Delivery special demo. CircleCI Director of Solutions Engineering, Eddie Webb will show us ...

696 views 0 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you