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

fabby January 13, 2013

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 votes
Answer accepted
Mizan
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.
January 14, 2013

Did you try using scripted fields provided by Script runner plugin ? There is a similar script provided in the docs https://studio.plugins.atlassian.com/wiki/display/GRV/Scripted+Fields#ScriptedFields-TotaltimethisissuehasbeenInProgress

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

fabby January 15, 2013

thanks,

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()
 
 log.warn("+++++++++++++++++++++++")
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"
}?.getCreated()

if(firstStart){ //has Start Progress
	Duration=firstStart?.getTime()-createTime
        // 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))
        if(timeSpent){
                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
        DateUtils.getDurationString(Math.round(timeSpent/1000))
}

2 votes
Tansu Akdeniz December 23, 2013

Hi,

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

1 vote
Thierry Molina June 18, 2014

Andrey,

Thank you for your work it is very usefull

1 vote
Thierry Molina June 18, 2014

Andrey

Thank you very much for your work it is very usefull

1 vote
Andrey Markelov
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.
September 1, 2013
Thierry Molina June 18, 2014

Andrey,

Thank you for your work it is very usefull

MattS
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.
June 18, 2014

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

Raju Adluru
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.
September 25, 2014

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

0 votes
fabby January 13, 2013

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

0 votes
Rahul Aich [Nagra]
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.
January 13, 2013

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.

https://confluence.atlassian.com/display/JIRA/JIRA+as+a+Support+System

Rahul

Renjith Pillai
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.
January 13, 2013

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

fabby January 13, 2013

i just want to use post function

fabby January 14, 2013

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.

fabby January 14, 2013

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.

Suggest an answer

Log in or Sign up to answer