Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Time in "Open" Status


I have found the following code but I require some assistance to modify the code.

I wish to show the time that an issue is in the "Open" status but with the code, it is somehow adding the "Open" status and "In Progress" time together and not accurately showing the information.

How do I modify this to just show the "Open" time?


import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.history.ChangeItemBean;
import com.atlassian.jira.issue.Issue;
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def statusName = "Open"
def createdDateDiff = System.currentTimeMillis() - issue.getCreated().getTime()
List<Long> rt = [0L]
rt << createdDateDiff
def changeItems = changeHistoryManager.getChangeItemsForField(issue, "status")
changeItems.reverse().each {ChangeItemBean item -> item.fromString
 // Get the time passed since status change
 def timeDiff = System.currentTimeMillis() - item.created.getTime()
 // If the status change left our status, we want to subtract the time passed since then
 if (item.fromString == statusName) {
 rt << -timeDiff
 // If the status change goes to our status, we want to add the time passed since then
 if (item.toString == statusName){
 rt << timeDiff
def total = (rt.sum() as Long) / 1000
return Math.round(total) ?: 0
Thank you. 1.JPG

3 answers

1 accepted

0 votes
Answer accepted
Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 10, 2022

Hi @Drishti Maharaj 

It should calculate the duration in Open status. Because statusName = "Open" is given as a parameter in the code. To be sure, can you please go to one sample issue and look at the history and verify the duration in open status?

Also check "Total time this issue has been In Progress" section in this doc

Hello @Drishti Maharaj 

As an alternative, you can try the third-party addons. Such as Time between Statuses (server version) by SaaSJet.  Just set the "Open" status as Start and Stop timers and get the time in the "Open" status

Hope it helps.


0 votes
Bloompeak Support
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Aug 10, 2022

Hi @Drishti Maharaj

If you prefer to use a plugin, you can try Status Time Reports app developed by our team. It mainly provides reports and gadgets based on how much time passed in each status.

Here is the online demo link, you can see it in action and try without installing the app. For your case, you can have a look at Time in Status for Each Issue report.

  • This app has a dynamic status grouping feature so that you can generate various valuable reports as as time in status, time in assignee, status entry dates and status counts, cycle time and lead time, average/sum reports by any field(e.g. average in progress time by project, average cycle time by issue creation month).
  • You can search issues by Project, Issue Type, Status, Assignee, Issue Creation/Resolution Date(and any other Date field) and JQL Query.
  • Status durations are calculated according to the working calendar you define. Once you enter your working calendar into the app, it takes your working schedule into account too. That is, "In Progress" time of an issue opened on Friday at 5 PM and closed on Monday at 9 AM, will be a few hours rather than 3 days.
  • You can set different duration formats.
  • You can export reports in CSV file format and open them in MS Excel.
  • You can also add this app as a gadget to your Jira dashboards and reach “Status Time” from Issue Detail page.
  • You can enable/disable access to Status Time reports&gadgets and Issue Detail page per project, users, groups or project role.

If you are looking for a free solution, you can try the limited version Status Time Free.

Hope it helps.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events