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

Automation rules using office hours

Michael Nassette January 6, 2023

I am trying to set up an automation rule that sends a message to a Slack channel when there is 30m left on an SLA timer for critical requests. This rule should only run on Monday-Friday from 09:00-17:00. Outside of these hours, a message to the same Slack channel has to be sent at the moment of creation.

I would assume, the best way to go about this is to set up an advanced compare condition using {now} as a value, and as a 2nd value have a dayofweek/businessday and a time range. The second value seems to be well beyond my understanding and skill level, or maybe I am just overcomplicating this and there is a much more straight forward solution for this.

Anybody have any suggestions?

3 answers

1 accepted

0 votes
Answer accepted
Stefan Wolske January 19, 2024

In case someone wants to follow the solution Michael.  Here is it copy and paste ready.

 

{{now.convertToTimeZone("Europe/Berlin").format("EEE,kk")}}
(Mon|Tue|Wed|Thu|Fri), (0[8-9]|1[0-7])

 

Thanks

0 votes
Kateryna_v_SaaSJet_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 17, 2023

Hello @Michael Nassette 

If you are okay with using third-party add-ons, here's another way to do what you need.

Using SLA Time and Report for Jira add-on, you need to create 2 working schedules (calendars) and add them to simple SLA configurations. 

1_2023-02-17_11-00-59.png
The first will be for Business Hours and a correction message 30 minutes after the trigger. 0_2023-02-17_12-09-05.png

You can also write your custom message for notification using Shortcodes (such as smart values).

2_2023-02-17_12-11-50.png
The second is the same logic configuration, but with a calendar for non-working hours and going to SLACK a minute after the trigger.3_2023-02-17_13-02-50.png4_2023-02-17_12-12-55.png

Try using it yourself to understand whether this option will suit you. Here is a link to a 30-day trial. My team develops the app, so if you require further assistance, kindly let me know.

0 votes
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 6, 2023

Hi @Michael Nassette - You could do something like this:

  • TRIGGER: Scheduled (Advanced Cron Expression)
    • 0 0,30 9-17 ? * * *
    • Priority = Critical AND "Time to resolution" != breached() AND "Time to resolution" < remaining(30m)
  • ACTION: Send Slack Message

 

Outside of these hours, a message to the same Slack channel has to be sent at the moment of creation.

This would be a separate automation rule:

  • TRIGGER: Issue Created
  • CONDITION: Priority = Critical
  • ACTION: Send Slack Message

 

 

Michael Nassette January 6, 2023

If I understand the cron expression correctly, this would run 2 times per hour, which is not what I am looking for. I want the passing of the time threshold to be treated in real time. The SLA threshold breached trigger would allow for that to happen, but only if I can build a condition that compares the current time (basically the moment the trigger occurs) to a day/time range. If they do not match, the action is to send a Slack message.

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 6, 2023

Sorry I missed the M-F in my original answer.  You could change the cron to this:

0 0/5 9-17 ? * MON,TUE,WED,THU,FRI *

This will execute every 5 mins (the most frequent allowed by automation) during that 9-5 window M-F.

One thing to consider with every 5 mins is that if something hasn't been dealt with since the last execution, it will get picked up again and send another message.  Up to you as to whether you want a "one and done" message or to continuously nag the team every 5 mins.

Michael Nassette January 9, 2023

This sadly will not cover the need (or want) for this to be real time, with the added potential of spammy behaviour in the Slack channel until there is a status change, or some other automation to kick in.

As there is an SLA threshold breached trigger built into the automations, I really expected there to be a cleaner configuration approach for this.

I have made some progress though, using the Advanced compare condition with the first value being {now.format("E k")} but need to build a regex for the second value to capture the right time window in which I want the automation rule to execute the next steps.

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2023

Apologies, I understand now that you're trying to trigger based upon SLA. 

  • TRIGGER: SLA Threshold Breached
    • Select your desired SLA
    • Select Will Breach in the next 30 mins
  • CONDITION: Priority = Critical
  • ACTION: Send Slack Message

You should not need anything further regarding business hours if you have set up the SLA calendar appropriately because the SLA threshold will be smart enough to not fire unless the issue falls within the active window.

Michael Nassette January 9, 2023

I wish it was that simple :) the SLA however runs 24/7 but the team responsible for the requests does not have enough resources (yet) to have a 24/7 presence. Outside of their current working hours the requests need to be send to a Slack channel from where an on-call setup is in place.

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2023

Ahh Got it... How about this:

  • TRIGGER: SLA Threshold Breached
    • Select your desired SLA
    • Select Will Breach in the next 30 mins
  • CONDITION: Priority = Critical
  • IF CONDITION (Advanced - All conditions match):
    • {{now.format("h")}}
      Greater Than
      8
    • {{now.format("h")}}
      Less Than
      18
    • ACTION: Send Slack Message (your slack channel for during office hours)
  • ELSE
    • ACTION (Send Slack Message (your slack channel for outside of office hours)
Michael Nassette January 9, 2023

Got it to work with this:
Schermafbeelding 2023-01-09 195203.png

Like Stefan Wolske likes this
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2023

Sorry - DIdn't close my brackets in my last reply.  Glad you got this working though.

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