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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to calculate the resolution time as a difference between 2 fields using Jira Automation Rules?

Hello, 

 

I would like to calculate the the difference between the Resolution time and the Created time in order to see in how much time the ticket was solved. I have defined a rule in Jira Automation Rules with the following expression : 

{{issue.created.diff(issue.resolved).hours}}

I have also created a custom field where this calculation shall be shown in the ticket. The custom field was created as number and it works. 

But I have a question cause I cannot figure this out : when I reopen a ticket (which was previously Solved) for a rework, and afterwards I put it again in Resolved, it is not clear for me if it's summing all the time the ticket was in Open/Progress or not. Cause what we would need is to have the sum of the total time the ticket was in progress before passing to Resolved.

 

Thanks, 

Irina 

1 answer

1 accepted

0 votes
Answer accepted
Dirk Ronsmans Community Leader Sep 23, 2020

Hi @Ionascu Irina ,

I couldn't find any details about the {{issue.resolved}} smartvalue so I did a quick test.

I Resolved an issue, re-opened it and Resolved it again.

When i comment on the issue with the {{issue.resolved}} value I can see the following below.

 

image.png

so yes, time was added!

The only questions for me is how does it see it as resolved, I would assume when the "Resolution" was set so just make sure when you re-open the issue that the Resolution is cleared. (which is best practice anyway)

Hi @Dirk Ronsmans ,

 

Thanks for the quick answer! Indeed, I also did a few more tests, and I understood where the problem might be with this summing... This formula always takes into account the creation date and the last Resolved date. Meaning, that for example, if I have a ticket set as Resolved now, with Resolution time 12 minutes, supposing I will reopen it after 30 minutes to do some rework, and keep it open for another 30 minutes, the new resolution time will be 72 minutes, which is not quite correct. Because the counter shouldn't count the time between Resolve until Reopen, meaning, it should calculate only the time between In Progress to Resolved, so it should be 12 minutes from the first iteration plus another 30 minutes from the second iteration, a total of 42 minutes and ignore the 30 minutes since the ticket was Resolved until I have reopened it. 

Do you know how we can solve this? I assume it must be a more complicated formula.. 

Dirk Ronsmans Community Leader Sep 23, 2020

Hi @Ionascu Irina ,

I see what you're trying to do but I fear this might not be possible without either an app or some more automation work..

It would basically mean going through the history and calculating how long the issue was in a specific status.

As you are using server a colleague of mine highly recommends the following app:

https://marketplace.atlassian.com/apps/1220908/time-in-status-field-timer-stopwatch-sla?hosting=server&tab=overview 

It's a free one so giving it a try shouldn't be a bad thing :)

Otherwise I fear you'll have to make some more custom fields and through automation calculate/write back the time for the statusses. (but that seems just what this app does)

 

Would you be open to using another app? Or is this something that "has" to be done using automation?

Thanks @Dirk Ronsmans ! I will try with this plugin as it is free. I am open to use apps if are free also, I started doing some thing with the Automation Rules and this is why I wanted to do it with this method, but even better if we have something that already does it 

Dirk Ronsmans Community Leader Sep 23, 2020

Great!

I fully get it and if this free app does what you need i to do all the better!

Should it for some reason be discontinued in the future you can always revisit the use case then and who knows maybe another solution exists by then!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Automation

New to Jira Automation - goodbye Cron (sort of), hello new project created trigger, new additions to

Hey Everyone! Simeon from the Automation team here. I'm delighted to share some new features and improvements that we are shipping to Jira automation (Cloud only). Firstly, @Sam Harding&nbsp...

2,860 views 10 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you