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

Automation for Weekend

Kadeem Samuel December 21, 2020

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

1 vote
Morgan Knicely
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 22, 2021

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.

0 votes
Italo Qualisoni [e-Core]
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.
December 21, 2020

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.

Kadeem Samuel December 21, 2020

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

Italo Qualisoni [e-Core]
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.
December 21, 2020

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

Kadeem Samuel December 21, 2020

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
AUG Leaders

Atlassian Community Events