ScriptRunner - keep track of how long an issue has been in a status

Roberto L
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.
February 2, 2018

Hello Community,

I have been trying to figure out a way to have a custom field that keeps track of how long an issue has been in a certain status. 
I have a Story issue type with Status: Open, In Review, In Progress, Done

I want to find a way such that I have 4 custom fields that displays how long the issue stayed in each status. 

  • Open Time
  • In Review Time
  • In progress Time,
  • Done Time

I have not been able to find a way to do so still.

Would anyone know how to achieve this?

Thank you!!

-Roberto

2 answers

0 votes
Markos Stefanou March 2, 2018

If you want to go at it the hard way, you need to add in your post function of each transition the current time and then calculate the difference between them and set the result in another field.

You would then need to do the following calculation for the new field:

(issueCreate.getTime() - linkedResolve.getTime())/(1000*60*60)

(The division differs depending whether you need the time in days, hours, minutes, seconds etc)

However, there are a number of addons that track time (even some free ones) that are probably much, much, MUCH better than reinventing the wheel yourself.

Time Reports for Jira
Issue History Collector
Status History

We are using another one named "Time In Status" for our instance.

0 votes
Alexey Matveev
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.
February 2, 2018

You would need to use ChangeHistoryManager. You can find more info here:

https://community.atlassian.com/t5/Jira-questions/How-to-get-assignee-change-history/qaq-p/453152

Suggest an answer

Log in or Sign up to answer