Script runner : how to get Resolution date to compare it with system date ?

Hello,

Is this possible for me to get the resolution date or closure date, to compare it with system date ?

If there is a delay of 24 hours between them, I would lik to refuse the reopening of the issue ...

Thanks a lot

2 answers

1 accepted

This widget could not be displayed.
Henning Tietgens Community Champion Sep 08, 2013

You can access the resolution date through

issue.resolutionDate

This is a Timestamp object which is a Date object, which you could use to compare it with the current date.

Thank you very much for your answer.

I am trying right now to use it to compare it with system date as written before.

Have a nice day !

Well, I've tried the following... but is does not work :-(

Do you think syntax is OK ?

Date now = new Date()
Date cfDate = new Date(issue.resolutionDate)
long elapsedTime= now.getTime() - cfDate.getTime()
boolean res = elapsedTime< 172800000 && elapsedTime>= 0

Henning Tietgens Community Champion Sep 08, 2013

Try

Date now = new Date()
long elapsedTime= now.getTime() - issue.resolutionDate.getTime()
boolean res = elapsedTime&lt; 172800000 &amp;&amp; elapsedTime&gt;= 0

But these are 48h if I calculated right... and make sure there is a resolution date.

Thank you Henning for your answer. I've tried this, but unfortunately it does not work. Perhaps because the resolution date is not specified like you think about.

I thought that a date was related to every step in JIRA... is this really ?

I mean :

- a creation date when you create an issue

- an update date, when you

- a resolution date,when you arrive at Resolved step

- a closure date, when you achieve the workflow, arriving at Closed step...

Henning Tietgens Community Champion Sep 09, 2013

If an issue is resolved the resolutionDate should be defined. You should try to debug the script like so.

Date now = new Date()
log.error "now: $now"
log.error "resolutionDate: $issue.resolutionDate"
long elapsedTime= now.getTime() - issue.resolutionDate.getTime()
log.error "elapsedTime: $elapsedTime"
boolean res = elapsedTime&lt; 172800000 &amp;&amp; elapsedTime&gt;= 0

Take a look into catalina.out to see the output.

This widget could not be displayed.

With the correct tag you get more attention!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

536 views 23 15
Join discussion

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