how to get 'Time In Source Status' like on Transition Tab?

my jira version is 4.4.1

i want to obtain spent time from Open status to Resolved status,and display the spent time in one custom field.

and find 'Time In Source Status' on Transition Tab is like what i want.

but i don't know how the 'Time In Source Status' comes from ?

7 answers

1 accepted

0 vote
Mizan Community Champion Jan 14, 2013

Did you try using scripted fields provided by Script runner plugin ? There is a similar script provided in the docs

You will need to modify it to suit your requirement , you will need to add one field for each status.


i used Scripted Field,below code is used to obtain time spent from first 'Open Status' to 'In Progress Status

import com.atlassian.core.util.DateUtils
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.history.ChangeItemBean
import com.atlassian.jira.issue.Issue 
def componentManager = ComponentManager.getInstance()
def changeHistoryManager = componentManager.getChangeHistoryManager()
def rt = [0]
def createTime=issue.getCreated().getTime() // getTime() tranfer to milliseconds
log.warn("create time:"+issue.getCreated().toString()+"to millisecond:"+issue.getCreated().getTime())
def firstStart=changeHistoryManager.getChangeItemsForField(issue, "status").find{
it.fromString=="Open" && it.toString=="In Progress"

if(firstStart){ //has Start Progress
        // NOTE: doesn't show anything if less than 60 seconds
        log.warn("Duration:"+Duration+"round:"+Math.round(Duration / 1000)+"timespent:"+DateUtils.getDurationString(Math.round(Duration / 1000)))
        def timeSpent=DateUtils.getDurationString(Math.round(Duration / 1000))
                return timeSpent
        }else{ //negative value or less than one minute
                return "less than one minute"
}else{ //there aren't workflow transitions executed yet.
	def timeSpent = System.currentTimeMillis() - createTime


Thank you for your work it is very usefull

Yes, the Issue History Collector aka datacollector worked well for us

Hi Andrey, thanks for this plugin, i see lot of positive feedback on this, can we get this data in filters so that we can create report multiple issues, like status, time in that status, assignee etc. columns in filters, same can be displayed in dash board Appreciate your help and support on this. Thanks Raj


There is a Time in Status Plugin on marketplace. You can get reports depending on user, project and advanced mode. You can export the reports to excel also.

Tansu Akdeniz


Thank you very much for your work it is very usefull


Thank you for your work it is very usefull

We have a plugin vertygoSLA which captures that information. This is a plugin to monitor and track SLA compliance. This is however not a free plugin but you can try it for free for 30 days.


Renjith Pillai Community Champion Jan 13, 2013

Transition tab comes from JIRA Suite Utilities. What do you mean by 'you want to use post function'?

i just want to use post function

hi Renjith

i just want ot retrieve the time spent from Open status to Resolved status. and store the spent time in one custom field.

so i consider using post function to obtain the spent time. and store the value in custom field.

i don't want to use script file to run groovy code , but i can not find any place to put my own groovy code.

i find the "Script Post-Function" ,it has 'Built-in-Scripts' and 'Script file path'.

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

285 views 38 9
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot