### Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
cancel
Showing results for
Did you mean:
See all
##### Top groups
Explore all groups

## Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user

Level 1: Seed

25 / 150 points

Next: Root

## Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

What goes around comes around! Share the love by gifting kudos to your peers.

## Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

disclaimer - I cannot use the SLA default functionality for this exercise so implementing it via automation and custom fields

Hello community!

I'm trying to set different SLA times by comparing creation date of a given ticket vs the timestamp of a transition to a certain status... some calculation use calendar days (24/7) and some use business days (8/5). I need the result to be returned in minutes  (as some SLAs counts e.g. 15 mins for response time since ticket creation).

For 24/7 ones Im using the following formula on an if-else block, and triggering an actions based on the result:

• {{issue.created.diff(now).minutes}}

While for 8/5 Im using the following formula:

The problem Im struggling with is that I need to work with concrete numbers like "SLA: 8 hours since ticket creation" and workdays/hours calendar as Im not able to hit the right formula to calculare exact elapsed time since ticket creation until the condition is met (e.g. status change).

Example:  considering working days is Mon to Fri, from 9am to 5pm, for a ticket created at 3pm on a Friday, if the SLA is 8 hours, due datetime should be next monday at 3pm.

In addition, I would like to know if it's possible to set national/local holidays into the formula (configurable).

The resulting number will be compared against the defined SLA.

#### 1 accepted

1 vote
Bill Sheboy
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 03, 2022 • edited

Next, you appear to be multiplying by 1440 which is the number of minutes in 24 hours, not 8 or 9 hours, or however long your work day is by the settings.

Regarding the holidays, I believe those (for projects settings) have no impact on the built-in business day checks for automation, so you would need to manually test for those dates with repeated conditions, or try some list filtering/incrementing.  I recommend searching for other posts trying to do this as I recall reading some indicating this is not straightforward to implement.

Finally, have you thought of this approach: when an issue is created use your expected SLA to set the Due Date field to {{issue.created.plusBusinessDays(yourSLAValue)} and then use another rule with a scheduled trigger and JQL to detect issues where the Due Date has lapsed past now?

Kind regards,
Bill

Hey @Bill Sheboy

1. I've asked IT admin to check the config related to workdays and working hours. Will come back once having feedback. Question: Is this what you called " built-in business day checks for automation" something implicit on global config I can use on my calculations? (e.g. when calling "BusinessDays" function it checks the general calendar config to know what is business days).

2. Yes, the 1440 is because when comparing 2 dates (datetime format) using business day, if the full day is not yet completed, the result of the calculation is 0 which leads me to error on the further formulas. By using the 1440 I define that the condition is met within 1 business day (in mins to keep consistency with other KPIs).

3. About your proposal, yes, I've tried out a similar approach. But how to set SLAs based on minutes or hours instead of days... Im not sure if it covers the various scenarios Im dealing with. Examples (working days: Mon / Fri from 9am to 6pm):

1. Case 1:
1. SLA response time since issue creation: 30 mins (only on business hours)
2. Ticket is opened on a Tuesday at 5:50pm
3. Due date for SLA should be Wednesday 9:20am (10 mins from Tue and 30 mins from Wed)
2. Case 2:
1. SLA response time since issue creation: 4 hours (only on business hours)
2. Ticket is opened on a Tuesday at 4pm
3. Due date for SLA should be Wednesday 11am (2 hours from Tue and 2 hours from Wed)
3. Case 3:
1. SLA resolution time since issue creation: 20 hours (only on business hours)
2. Ticket is opened on a Friday at 3pm
3. Due date for SLA should be Wednesday 10am (5 hours from Fri, 8 hours from Mon, 8 hours from Tue and 1 hour from Wed)

If Im able to get an accurate result out of this, I can easily compare/manage accordingly as you are suggesting... but so far couldn't make it work.

Regards,

Esteban

I made it work by using the proposed approach (by setting sth like "{{issue.created.plusBusinessHours(1).minusMinutes(30)}}" for 30 mins within business hours)

Thanks for the feedback @Bill Sheboy !

Bill Sheboy likes this
Bill Sheboy
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 04, 2022 • edited

Replacing my response...

I did not know there was a plusBusinessHours() feature.  Well done!

neither I did... nor even that several logic can be combined in same calculation (like plus and minus).

FYI - I cannot use default SLA functionality as a) I want consistency across multiple projects and units (internal and external), something I get as some projects has been created not as service project but development ones, b) while fetching JIRA data from Confluence via nested macros, some fields are seen but no value on them despite I can see them fulfilled on JIRA

Bill Sheboy
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 04, 2022

For the missing data in the Confluence macros, I recommend working with your site admin to submit a ticket to Atlassian Support as they may not know about that symptom: https://support.atlassian.com/contact/#/

Esteban Borja Lopez likes this

@Esteban Borja Lopez I am working on a similar use case, but instead of populating custom field, I am triggering email notifications if the SLA has missed,

Can you explain the formula you have used for 30 min SLA calculation with an example?