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

Automation: Calculate an issues lifetime

Donika Pacolli April 26, 2023

Hi all,

I need to fill out a field with number of days, that an issue 'has been alive' i.e from status 'open' until 'closed'. How do I create this form of calculation in Automation? 

Thanks in advance!

Best regards
Donika

1 answer

2 votes
Callum Carlile _Automation Consultants_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2023

Hi @Donika Pacolli 

You can use the {{[date1].diff([date2]).[unit]}} smart value to do this.

So if you're looking to calculate that time in days between creation and closure, you could enter the following into an Edit Issue action under your field where you want to reflect this (or could use it in a comment) :

{{created.diff(now).days}}

You could also change the unit to business days if you would prefer:

{{created.diff(now).businessDays}}

The rule could then be triggered on your transition into your Closed status, or you could run a scheduled rule to run, say, each morning which would give update this 'count' each day. See here for more info on the units available.

I hope this helps!

Donika Pacolli April 26, 2023

Hi @Callum Carlile _Automation Consultants_ 

Thank you for your answer - Super helpful!

I am quite new to Jira - can you please tell me how I can run a scheduled rule to run each morning to update the count? 

Does this need a new automation rule or can it be imbedded in the same rule as above?

 

Best
Donika

Callum Carlile _Automation Consultants_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2023

So a rule can only have one trigger - so in your case it could either be triggered whenever an issue is transitioned to your final workflow status, or it could be triggered each day that the issue is in any status EXCEPT for your final workflow status (as you would want it to stop running at this point).

For the scheduled trigger, it's pretty simple to set up, and you can set the frequency and time of day as so:

trigger.png

^Here, you would just need to change 'closed' to whatever the name of your final workflow status is.

You could alternatively use the CRON tab to add an expression to set the frequency, which gives you the ability to add more conditions to it (e..g Mon-Fri) - see here for more info.

Only thing to keep in mind with the scheduled trigger as opposed to the transition trigger, is that this will run every day for every issue in your project until it is in the final status, so if you have thousands of open issues, it might start to breach as you may hit the service limit. But with the transition trigger, it will just run one time as soon as the task is closed

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events