Jira automation: Cron condition every 2 weeks

Sergio Montávez January 26, 2021

Hi, I'm creating a Jira Automation rule and I want it to be launched on each Monday alternatively, in other words the first day of a 2 weeks timeframe.

 

I've checked the CRON documentation but cannot find the solution: https://support.atlassian.com/jira-software-cloud/docs/construct-cron-expressions-for-a-filter-subscription/

Thanks!

1 answer

2 votes
Ismael Jimoh
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.
January 26, 2021

Hi @Sergio Montávez 

I believe the standard cron doesn’t provide such a feature and you may need to look at a more complex expression which Jiramay still not support.

Have a look at this article: https://coderwall.com/p/yzzu5a/running-a-cron-job-every-other-week where the author shows running a cron expression every other Monday. Note still that this depends on if Jira supports expressions in your cron job.

If anyone is more familiar, I hope you can help here.

Sergio Montávez January 27, 2021

Thanks for the answer, unfortunately, some of those expressions are not supported by Jira according to their documentation: https://support.atlassian.com/jira-software-cloud/docs/construct-cron-expressions-for-a-filter-subscription/

Cengiz Akyildiz November 29, 2022

Hi,

This post seems to be old, but still wanted to share if it helps someone else.

I have similar case for a rule that should run every 3 weeks on Mondays 9am. So I ended up creating a cron job that runs every Monday at 9am, however I tried to use a condition that will result true every 3 weeks from the base date you give. For example my base date is 2022-11-14 which is again Monday I've used below expression:

{{#=}} {{now.diff(now.withYear(2022).withMonth(11).withDayOfMonth(14)).abs.days}} % 21 {{/}}

Above value would return zero for every 21 days (3 weeks) starting from the base date and you can let the rule do whatever action it needed. Tweaking with the numbers you can set any fixed frequency. The expression might be optimized further, but it simply runs.

And also I still don't get it why A4J for DC still does have a cloud-like fixed schedule feature, makes life easier for Jira admins ;)

Stian Nielsen-Man
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 10, 2023

Hi @Cengiz Akyildiz , where do you use the expression – it it in the subscription cron field? It doesn't seem to allow me to put curly brackets in that field.

Cengiz Akyildiz June 10, 2023

Nope, it is in the Advanced compare condition...

screenshot.png

Suggest an answer

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

Atlassian Community Events