How to exclude a specific date without using complicated Cron expressions in Automation for Jira
Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
In Automation for Jira, you can configure the execution period with Schedule Trigger in the following ways;
Fixed date schedule
ex: every X Days/Hours/Minutes
“Advanced(CRON expressions)“ is popular when you specify a time. However, the configuration of “execute 9:30 AM to 10:00 PM from Monday to Friday every 15 minutes“ is difficult to express in a CRON expression.
1
// NG It works "9:00 AM", "9:15 AM", "10:00 PM", "10:15 PM", "10:30 PM" and "10:45 PM"0 0/15 9-22 * * MON-FRI *
You can also configure with multiple CRON lines in Linux, but “Automation for Jira“ is unable to configure with multiple CRON lines. You will need to separate Automation, but it will be complicated.
1
2
3
4
// "Automation for Jira" can't be setting in multiple lines
0 30,45 9 * * MON-FRI *
0 0/15 10-21 * * MON-FRI *
0 0 22 * * MON-FRI *
Solution
You can exclude the specified date by using Advanced compare condition.
Using the built-in functions “now”, you can get the current date and compare it with the condition, and you can exclude the specified date. Following these configurations, you can get the configuration “execute 9:30 AM to 10:00 PM from Monday to Friday every 15 minutes“.
CRON expressions
1
// CRON Expression: It works "9:00 AM", "9:15 AM", "10:00 PM", "10:15 PM", "10:30 PM" and "10:45 PM"0 0/15 9-22 * * MON-FRI *
Advanced compare condition
Field | Value |
First Value | {{now.convertToTimeZone("Asia/Tokyo").shortTime}} |
Condition | does not match regular expressions |
Regular expression | (9:(00|15) AM)|(10:(15|30|45) PM) |
(Tips)Audit Log
When Automation is successful, the status will be "SUCCESS"
When the Condition is rejected, the status will be "NO ACTIONS PERFORMED"
Was this helpful?