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

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 Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,212
Community Members
 
Community Events
176
Community Groups

Apply an SLA based on ticket creation date

Hi, 

For one client, we have an extended SLA in place with an SLA matrix based on issue priority (3 levels) and the moment an issue was raised (3 possible time windows). 

Our Time to first response and Time to resolution depends on when the ticket was created and what the priority is.

A Critical ticket opened on a Saturday needs an answer within 4 hours. 

A Critical ticket created on a Monday afternoon needs an answer within 2 hours. 

Currently, I haven't been able to automate applying an SLA based on those criteria. 

Does anyone have had any luck with this? 

1 answer

1 accepted

1 vote
Answer accepted

Hi @Stijn Despiegelaere 

Your JQL for the SLA is going to need to incorporate two things:

  • The Priority of a ticket
  • The day it is raised on

---

SLAs

Just to confirm you're aware, one SLA can have multiple Goals - these Goals can use JQL to set different SLA targets depending on the results of the JQL search.

You can add multiple Goals to a SLA using the "+" button just below the original Goal.

For more information on Goals, see this help page

---

JQL for Goals

The JQL for priority should be relatively easy - it should be

priority = Critical

Then, the JQL for the day of the week should be possible using the JQL functions  startOfWeek() and endOfWeek() - these work as follows:

  • startOfWeek() is classed as Sunday, whilst endOfWeek() counts as Saturday
  • You can refer to other days of the week using additional numeric values in the brackets - for example, Monday is startOfWeek(1d)
    • The "d" refers to days. If you're referring to weeks, you don't need a letter
  • This help page explains all the things these functions can do

So for example, we should be able to limit a query to recognise the created day as Saturday by using the following JQL:

priority = Critical AND created >= endOfWeek() AND created < startOfWeek(1)

And Monday's JQL would be:

priority = Critical AND created >= startOfWeek(1d) AND created < startOfWeek(2d)

---

You could use these JQL's in different Goals, with different Time Goals, and they should then set correctly!

Note: The JQL for Saturday is untestedbecause it's not Saturday today. I would strongly recommend testing this before setting it to live in your production environment.

---

Let us know if this helps!

Ste

Hi, thanks for the help. 

I thought of doing something like this, but was hoping it didn't come to this. Mainly because on top of the day of the week, I need to incorporate the office hours. 

So Monday after 5 PM is treated differently then Monday at 4:30 PM. 

Hi @Stijn Despiegelaere 

Can you explain all the rules in more detail?

Depending on what the rules are and how they're based (eg. per day, or based on the business week, etc) - there might be alternatives using...

  • Different Calendars and/or...
  • Custom Fields and Automation Rules, to provide more metadata to use in the JQL

Ste

Hi @Stephen Wright _Elabor8_ 

We have three different levels to group our Time to first response: 

  • Office hours: Monday-Friday from 9am to 5 pm
  • Outside office hours on those days
  • Weekends and holidays.

In each of those scenarios, we have a different Time to first response based on the priority of the ticket. There are three levels of priority.

To make matters more complicated, for some priority levels, the time to first response only starts counting on the start of the next business day (so during the times of the Office Hours calendar). 

The priority is given by the external company logging the tickets, but can be changed by us after triage. 

I already tried setting up different calendars (Office Hours, Outside Office Hours, Weekends&Holidays) in one SLA, but during testing, tickets I created during Office Hours showed up with the SLA of Weekends&Holidays since this was ranked higher). 

I had hoped there would be a setting or a way to use those calendars in the JQL to limit that rule to only apply to tickets created during those hours, but had nu luck finding such a setting. 

I could also create three types of requests to add some custom field or use a custom issue type, but then I am expecting the client to choose the right type. The problem with this is that we are based in Belgium, but the client has factories in the US and in Eastern Europe, while the SLA is following our time zone. 

Hi @Stijn Despiegelaere 

I think I've found a way to make this simpler. What I did was...

  • Created 2 Custom Fields - Business Week, Business Hours
  • Created 2 Automation Rules to set those Fields
  • Explored having multiple calendars within SLAs

This will provide sufficient parameters to create SLAs (with JQL) based off "working hours" vs "non-working hours".

Note:

  • I would recommend testing this approach thoroughly before going live
  • Your SLAs might still be more complex than what I'm recommending - in that instance I would either...
    • Try to build further on the below or...
    • Question if the SLAs are too complex, and should be reviewed

---

Custom Fields

Create two Select List (single choice) Custom Fields:

  1. Business Week: Yes, No
  2. Business Hours: Yes, No

These will be used in JQL but will be easier to refer to than every day/time of the week using date functions.

Automation will populate them (see below).

---

Automation Rule 1 - Business Week

This rule will populate Business Week as "Yes" if a ticket is created Monday-Friday, or "No" if Saturday-Sunday.

  • Trigger: Issue Created
  • Action: Re-fetch Issue Data
  • Condition: If/Else Block
    • IF...
      • Sub-Condition: Advanced Condition
        • First Value = {{issue.created.convertToTimeZone("<Timezone Here>").format("E")}}
        • Condition = exactly matches regular expression
        • Second Value = (Mon|Tue|Wed|Thu|Fri)
      • Sub-Action: Edit Issue
        • Field = Business Week
          • Value = Yes
    • ELSE-IF...
      • Sub-Condition: Advanced Condition
        • First Value = {{issue.created.convertToTimeZone("<Timezone Here>").format("E")}}
        • Condition = exactly matches regular expression
        • Second Value = (Sat|Sun)
      • Sub-Action: Edit Issue
        • Field = Business Week
          • Value = No

---

Automation Rule 2 - Business Hours

This rule will populate Business Hours as "Yes" if a ticket is created between 9am-5pm, or "No" if not.

  • Trigger: Issue Created
  • Action: Re-fetch Issue Data
  • Condition: If/Else Block
    • IF...
      • Sub-Condition: Advanced Condition
        • First Value = {{issue.created.convertToTimeZone("<Timezone Here>").format("H")}}
        • Condition = exactly matches regular expression
        • Second Value = (9|1[0-7])
      • Sub-Action: Edit Issue
        • Field = Business Hours
          • Value = Yes
    • ELSE-IF...
      • Sub-Condition: Advanced Condition
        • First Value = {{issue.created.convertToTimeZone("<Timezone Here>").format("H")}}
        • Condition = does not match regular expression
        • Second Value = (Sat|Sun)
      • Sub-Action: Edit Issue
        • Field = Business Hours
          • Value = No

---

Automation - Notes

  • These rules are just examples - you'll need to refine them to your company's working days/hours
  • You could take these further - for example, if there's a need to set SLAs based on specific times, you could have further Custom Fields to capture AM vs PM, and further Automation Rules to populate them.
  • The timezone is set on each Advanced Condition to ensure it is consistently set to your timezone. You don't need the "< >" characters - so for example, your timezone might be "Europe/Brussels". See what options exist for timezones on this website (as suggested by Atlassian, on this help page).
  • You can add additional Sub-Conditions for holidays as required - but as these can change year-to-year, I'd recommend using JQL Conditions and searching for specific dates. For example, Christmas might be...
    • created >= 2023-12-25 AND created < 2023-12-26

---

Calendars

You also mentioned that there might be different calendars depending on prioritisation levels.

You can have different Calendars within Jira Service Management - including in the same SLA - to create them:

  • Go to Project Settings > SLAs
  • In the top-right corner, select the Calendar Icon/Button
  • Press the Add Calendar button

You'll need to decide on what parameters you need here, but you can create calendars inclusive of:

  • Working days/hours
  • Holidays (based on date only)

For more information - see this help page

---

Creating the SLAs

You can then put this all together to create your SLAs!

Some will be more complex than others - for example, high priority issues might require a...

  • 24 hour calendar
    • JQL 1 = Within Business Hours
    • JQL 2 = Within Business Week, outside of Business Hours
    • JQL 3 = Weekend

And others might be simpler - for example, low priority issues might require only...

  • Business Hours/Week calendar
  • "All Issues" treated the same

You'll just need to work out each parameter and create an SLA/JQL for it.

 


 

Hopefully this is sufficient to help direct you in the right direction :) - but let us know if you have any further questions or queries!

Just as a final note, I want to say thanks to Bill whose answer in this question helped drive the design above.

Ste

This seems like the way to go. Thanks!

Suggest an answer

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

Atlassian Community Events