Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SLA calculation

Andile Luvuno
Contributor
January 11, 2022

Good Day All.

I have 2 date/time fields(Time Arrived and Time Departed), these are manually populated 

Is there a way i can calculate the "time spent" and display it on a particular field?

Your assistance would be highly appreciated.

2 answers

2 accepted

5 votes
Answer accepted
Alex Koxaras _Relational_
Community Champion
January 12, 2022

Hi @Andile Luvuno 

You can achieve this in multiple ways, either via Jira Automation, or an app such as script runner, JMWE, JSU calculated fields etc.

Prior of doing anything with an app, try creating an automation rule using a smart value to calculate the difference between these two dates:

{{[date1].diff([date2]).[unit]}}

I would strongly suggest to look at the examples on the link I've pasted to become more familiar with this smart value.

Now, the way I see it, I would place the trigger on field value change, right after the user has placed the second date value.

Let me know if that works out for you! 

Andile Luvuno
Contributor
January 12, 2022

Hi @Alex Koxaras _Relational_ 

Thank you very much for the above.

I am not quite clued up when it comes to JIRA Automation, would it be possible for you to maybe show me with an example of how you would create this automation?

These are my fields

Date/Time Received, Date/Time Resolved and the results should be displayed in a field called Time Spent

I've gotten as far as creating a trigger for "Field Value Changed" and I pretty much got stuck after that as there are a bunch of components like "New Branch", New Action" and "New condition"

Alex Koxaras _Relational_
Community Champion
January 12, 2022

@Andile Luvuno try something like the following (but again, it depends on what type of field you want this information and what exactly you want to capture. "Time Spent" as defined by Jira is very specific field and used for a specific reason.

ruleSLA.png

{{PlannedStartDate.diff(Planned end date).BusinessDays}}

Just change the "PlannedStartDate" and "Planned end date" fields to your liking, as well as "Description Field" with your CF "Time Spent" field (hopefully you are talking about a CF).

Let me know if that works.

Andile Luvuno
Contributor
January 12, 2022

Thank you Very much @Alex Koxaras _Relational_ that works 

2 votes
Answer accepted
Sebastian Krzewiński
Community Champion
January 12, 2022

Hi @Andile Luvuno 

 

What came to my mind to achieve this is using Automation for Jira (https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/) or Script runner.

 

Regards,

Seba

Suggest an answer

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

Atlassian Community Events