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

SLA calculation

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 Community Leader Jan 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! 

Hi @Alex Koxaras 

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 Community Leader Jan 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.

Thank you Very much @Alex Koxaras that works 

Like Alex Koxaras likes this
2 votes
Answer accepted

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
Site Admin
TAGS
Community showcase
Published in Jira Service Management

JSM Jira Automation: How to Send SLA Breached Notifications

Hi Everyone, In   this tutorial,  we will show you how you can monitor an SLA, and send notifications before or after the SLA has been breached.   SLA Threshold Trigger The SLA t...

802 views 5 13
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