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

Automation for Weekend

Hello, we have a JQL statement for our weekend oncall tickets however some appear to not hit the criteria necessary. Wondering if this statement is correct for reaching all tickets on Saturday & Sunday.

{{#=}}({{now.convertToTimeZone("America/New_York").dayOfWeek}} > 5) && ({{now.convertToTimeZone("America/New_York").dayOfWeek}} < 7){{/}}

Kind Regards

3 answers

Here is your original expression, updated to correctly identify Saturday and Sunday.

{{#=}}({{now.convertToTimeZone("America/New_York").dayOfWeek}} = 6) || ({{now.convertToTimeZone("America/New_York").dayOfWeek}} = 0){{/}}

dayOfWeek begins with 0 on Sunday, so Saturday is 6.

Our company is global so I had to check for time in addition to day of week. I started with your A4J expression and modified it to identify events occurring after 02:00 UTC Saturday and before 22:00 UTC Sunday. Our server runs on UTC time so I did not need to convert timezones.

Trigger: Issue Created

Filter: Advanced Compare Condition

{{#=}}
({{now.dayOfWeek}} == 6 && {{now.isAfter(now.withHour(2).withMinute(0).withSecond(0).withMillis(0))}})
||
({{now.dayOfWeek}} == 0 && {{now.isBefore(now.withHour(22).withMinute(0).withSecond(0).withMillis(0))}})
{{/}}

is greater than 0.

Translated to human...

Now is Saturday after 02:00 or now is Sunday before 22:00.

Hi @Kadeem Samuel ,

Can you share more about what are you trying to achieve? Maybe a share your Automation Trigger and conditions would help to understand your issue and propose a solution.

Hello Italo,

Thank you for the reply; the following is the automation we are trying to correct. Basically, want any support request that comes in all day Saturday and Sunday to get tagged as on-call. We have a second automation that handles the weekday time frame
2020-12-21 16_48_57-Automation rules - JIRA.jpg

Can you try this condition instead? This will check if the current day is either Saturday or Sunday in the NYC timezone. 

First value: {{now.convertToTimeZone("America/New_York").dayOfWeekName}}

Condition: contains regular expression

Regular expression: (Saturday|Sunday)

testautomation.png

I encourage you to also use a log action(see in my image the component under the condition), you can use this to check the {{now.convertToTimeZone("America/New_York").dayOfWeekName}} value in the audit log in execution and it can help you to check the value of your smart value.

Hope this helps!

0 votes
Sudarshan Community Leader Dec 21, 2020

Hello @Kadeem Samuel 
Did you try with a <=5.?

It may sound nothing, but with the information your question has, I think some of the tickets may jump out with the time conversion in the query.
Let me know if there is any change.

Thank you for replying Sudarshan, I will give that change a shot over the weekend to see how it responds.

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...

760 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