How can I calculate time in status for a ticket in a certain project?

Saad Haq May 6, 2024

Using Jira server, I have created a custom field that requires a groovy script to calculate duration. Using that field I want to get a time in status for tickets in a jira project, let's say project X. There are several tickets, now in project X, that were in other projects before landing in project X; I only want to extract the time in a status for the time in project X only. Is there a way to do that?

5 answers

2 votes
Valeriia_Havrylenko_SaaSJet
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 14, 2024

Hi @Saad Haq and welcome to the Atlassian Community! 👋

If you are looking for a better OOTB and user friendly solution try Time In Status
 data center version.
For this just simply:

  1. Choose Time in Status report
  2. Select the project you need

Знімок екрана 2024-05-14 о 12.13.58.png

With our add-on you will be also able to:

  • Exclude non-working time using calendars
  • Utilizing gadgets to enable multiple reports on a Jira Dashboard.
  • Share reports with external users using export in XLS/CSV.

We strive to be the best for you!

You can also book a live demo - we'll show you the application inside out and answer all your questions.

Have a great day 🥳

Saad Haq May 14, 2024

Hi @Valeriia_Havrylenko_SaaSJet , can this also provide a time in status for the time the ticket was in a specific Jira project?  For example, if I have a Jira ticket in the "In Progress" status in Project A for 4 weeks, but then it has moved to Project B, and it has stayed in the "In Progress" status in Project B for 6 weeks. Using this app, can I get the Time In Status for the time that it was in Project B only? I should get 6 weeks and not 10 weeks.

Thanks,

-Saad

Valeriia_Havrylenko_SaaSJet
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 14, 2024

@Saad Haq Of course. When you choose a project, the task time in the status will be calculated only for the selected project.

1 vote
Amay Purohit_RVS
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.
May 13, 2024

Hi @Saad Haq 

 

Welcome to the community !!

If you would be interested in a readymade solution, you can try out 

Time in Status Reports 

With our app, you can effortlessly track and visualize how much time your tasks spend in each status, gaining invaluable insights into bottlenecks, efficiency, and team performance. You can generate multiple reports such as:

- time in status for Jira issues with multiple filter options to narrow down you search

- Time with assignee for your issues

- average time issue has been spent in each status

- Status Transition dates of issues

- transition and status count for each issue

- Group your statuses to define your own Cycle/Lead times

Hope this helps.

More details here

The app is free for 10 users. Do try it out.

Disclaimer : I work for RVS, the vendor for this app

TIS-1.png

Saad Haq May 14, 2024

Hi @Amay Purohit_RVS , can this also provide a time in status for the time the ticket was in a specific Jira project?  For example, if I have a Jira ticket in the "In Progress" status in Project A for 4 weeks, but then it has moved to Project B, and it has stayed in the "In Progress" status in Project B for 6 weeks. Using this app, can I get the Time In Status for the time that it was in Project B only? I should get 6 weeks and not 10 weeks.

-Saad

Amay Purohit_RVS
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.
May 14, 2024

Hi @Saad Haq 

Thanks for your reply. Unfortunately, we do not have a report like "Time in Project". However I have spoken to my dev team and we will add this requirement to our queue and will implement it as per priority. 

Thanks

Saad Haq May 14, 2024

Thank you @Amay Purohit_RVS .  Do you know what that timeline may be?

1 vote
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 6, 2024

Hi @Saad Haq 

Welcome to the community!

Presumably, the script you are creating to calculate the time in status is going to use the issue history to detect all the status changes and their timestamps.

The move operation will also be found in the history.

So it should be possible to filter the history data to only include changes that take place after the issue key (project) was changed.

Somethings along these lines:

import com.atlassian.jira.component.ComponentAccessor

def chm = ComponentAccessor.changeHistoryManager
def issue=Issues.getByKey('ASP-5538')

def projectChanges = chm.getChangeItemsForField(issue, 'project')
def startDate = issue.created
if(projectChanges){
startDate = projectChanges.last().created
}
def statusChanges = chm.getChangeItemsForField(issue, 'status')

statusChanges.findAll{it.created > startDate}
Saad Haq May 12, 2024

Hi @Peter-Dave Sheehan,

Thank you for providing this snippet. If I want to create a filter with this custom field, will this give me the time in status for all Jira tickets, or one jira ticket only?

Also, I have not created a script before, so I am in new territory here. Any additional help would be greatly appreciated.

-Saad

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 14, 2024

It appears this custom field will be provided by the Jira Misc Custom Field app. I suggest you refer to their documentation for more detailed instructions.

But generally, the way a calculated script would work is that the value is calculated either each time the ticket is accessed or saved. This happens for each ticket where that calculated field is applicable (using custom field context).

And depending on the app, the value is either stored in the database and in the search index, or just in the search index. I'm not sure with JMCF which it is.

This means that JQL search should work to find issues that match a specific value for the custom field (depending on the type of searcher associated with the field).

But that will not work immediately for all historical tickets until you perform a full re-index in order to populate the search index with a value for all those tickets. It will work immediately for all issues created or modified after you roll out the new field.

0 votes
Bloompeak Support
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 13, 2024

Hi @Saad Haq

Welcome to the Atlassian Community!

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.

For further details, you can have a look at Status Time Reports How to Videos.

  • This app has a dynamic status grouping feature so that you can generate various valuable reports as time in status, time in assignee, status entry dates and status counts, cycle time and lead time, resolution 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 completely free solution, you can try the limited version Status Time Reports Free.

If you have any questions, feel free to schedule a demo with us.

Hope it helps.

Saad Haq May 14, 2024

Hi @Bloompeak Support

Can this also provide a time in status for the time the ticket was in a specific Jira project?  For example, if I have a Jira ticket in the "In Progress" status in Project A for 4 weeks, but then it has moved to Project B, and it has stayed in the "In Progress" status in Project B for 6 weeks. Using this app, can I get the Time In Status for the time that it was in Project B only? I should get 6 weeks and not 10 weeks.

Thanks,

-Saad

Bloompeak Support
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 15, 2024

Hi @Saad Haq ,

It is possible in one of the two cases below.

  1. It is possible if both projects are team-managed projects.
  2. If projects are not team-managed projects but the issues are moved from project A to project B at the same time as bulk, then as a workaround you can use the history filtering. By setting the history start date to the date of issue movement date, you can exclude the time passed in project A.history.png

Otherwise, it is not possible to differentiate it.

0 votes
Gizem Gökçe _OBSS_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 13, 2024

Hello @Saad Haq ,

Welcome to the community!

Generating a script to obtain this information would be a time-consuming process, as there are already ready-made apps specifically designed for this purpose. So in order to track the time spent on each status I suggest you use a marketplace app. Timepiece (formerly Time in Status) ,the oldest and leading "Time in Status" app in Atlassian Marketplace, which is developed by my team at OBSS, has a report type that will meet your need.  Our app is available for both Jira Cloud, and Data Center. 

Timepiece mainly allows you to see how much time each issue spent on each status or each assignee

Status Duration report (please see the screenshot above) which shows how much time each issue spent on each status. You can combine the time for multiple statuses to get metrics like Issue Age, Cycle Time, Lead Time, Resolution Time etc. Status Duration Report in Detail.png

For all numeric report types, you can view the durations as a list and calculate averages and sums of those durations grouped by the issue fields you select.

Group By Created Month.png

The app calculates its reports using already existing Jira issue histories so when you install the app, you don't need to add anything to your issue workflows and you can get reports on your past issues as well.

Tiimepiece reports can be accessed through its own reporting page, dashboard gadgets, and issue view screen tabs. All these options can provide both calculated data tables and charts. And the app has a REST API so you can get the reports from Jira UI or via REST. 

We invite you to visit Timepiece (formerly Time in Status) to explore and enjoy a 30-day free trial of our full range of features.

If you wish, you can also schedule a live demo. We will provide a comprehensive overview of the application and address any inquiries you may have.

Hope it helps,

Gizem

Gizem Gökçe _OBSS_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 15, 2024

Hello @Saad Haq ,

In  Timepiece (formerly Time in Status) it is also possible to provide a time in status for the time the ticket was in a specific Jira project.

In the example below I moved these issues into 3 different projects and you can see how much time each issue spent on each status in each project. 

Any field duration 1.pngAny Field Duration 2.png

Suggest an answer

Log in or Sign up to answer