Forums

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

How to use smart values to set a 3 day working automated SLA on a ticket?

David Naylor July 10, 2024

I'm trying to set up a ticket SLA based on 3 working days so:

- if it's opened on a Friday after 5.30pm,  Saturday or Sunday the clock 'starts' at 9am on Monday. 

- if it's opened after midnight but before 9am, the clock starts at 9am the same day

- if it's opened after 5.30pm, the clock starts at 9am the next working day.

 

I've worked out the logic for each if/else block in order to calculate the 'startTimer' value in each scenario and have been using Log Action to print the relevant values to the log so I can confirm each works correctly. The routine is failing each time I try to set the endTimer - 3 business days after the startTimer value. An example is below using values from the log.

 

Issue created: 2024-05-30T18:24:47.4+0000

 

As this is after hours, the startTimer value is calculated as:

startTimer = {issue.created.plusDays(1).withHour(9).withMinute(0)}}

and the correctly logged value is:

startTimer = 2024-05-31T09:00:47.4+0000

 

Use plusBusinessDays to set the end timer and it fails to return a value

endTimer = {{startTimer.plusBusinessDays(3)}}

endTimer returns as null

 

The automation shows that it has been executed successfully. What am I missing in the way I use the smart value? thanks

1 answer

2 votes
Mikael Sandberg
Community Champion
July 10, 2024

Hi @David Naylor

Welcome to Atlassian Community!

You do not have to use automation to do this, all you have to do is go and change the calendar used by the SLA so that the calendar is not counting the weekend. Here is an example of the 9-5 workday calendar

Screenshot 2024-07-10 at 1.12.34 PM.png 

If a request is created outside of the defined times the SLA will be paused until the next work day.

David Naylor July 10, 2024

Hi @Mikael Sandberg 

Thanks. I'm using a Jira software project and the only settings I can find to control hours are the Time Tracking settings (below). I think your screenshot is from a service project? If not, can you point me to that setting? 

Screenshot 2024-07-10 at 22.07.56.png

Mikael Sandberg
Community Champion
July 10, 2024

Okay, your question ended up in the wrong collection then.

The time stamps that you are trying to set are related to time tracking, not SLAs. So are you trying to use time tracking as some sort of SLA? The error you get on the end time is expected since the log work does not allow you to set a future date in it. 

In order to use SLAs in Jira Software you would have to either use your own custom fields for the start/end dates or use one if the SLA apps in the Marketplace.

Like # people like this
David Naylor July 11, 2024

Thanks Mike. Yes I'm using all custom fields. Ultimately the endTimer value is written to a custom field called Due time-date which we monitor in our reporting. I sorry but I don't follow your point about 'the log work does not allow you to set future date in it'.

If the startTimer value is constructed correctly, why does the plusBusinessDays smart value not work?

The last element of my if/else structure doesn't need me to set the value of endTimer since I don't need to account for out of hours. In this step I simply use:

Due time-date = {{issue.created.PlusBusinessDays(3)}}

and that works fine

Mikael Sandberg
Community Champion
July 11, 2024

Okay, because you included the screenshot of the time tracking feature I assumed you tried to use those date fields.

So are startTimer and endTimer both variables? The reason that {{startTimer.plusBusinessDays(3)}} is not working could be that you need to convert it to a date format that Jira understands. You could try and add .jiraDate at the end to see if that returns a value.

Suggest an answer

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

Atlassian Community Events