Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

current year condition for automation rule

jun lee
Contributor
January 3, 2024

Hi

I am trying to add an automation rule for creating an issue monthly.

trigger : Scheduled,    31 Days, simply run the conditions and actions without providing issues

if : JQL condition,   {{now.date.year}} = 2024

action : create issue

 

If I remove the JQL condition, it works. However I need the current year condition, because I will use branch component like as {{now.date.year}} = 2024, {{now.date.year}} = 2025, and so on. 

 

Can you advice for me?

 

1 answer

1 accepted

0 votes
Answer accepted
Rebekka Heilmann _viadee_
Community Champion
January 3, 2024

{{now().year}}

is giving me 2024 as a result

Screenshot 2024-01-03 122929.png

 

Having it scheduled every 31 days though will not trigger it on the 1. of every month. You can use cron expressions to achieve that. If I googled correctly (not an expert on that part) it should be 

0 0 1 * *

to run it 12.00 AM on the first of every month

Radek Dostál
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 3, 2024

I don't think that CRON is right, according to https://confluence.atlassian.com/jirasoftwareserver/constructing-cron-expressions-for-a-filter-subscription-939938814.html

 

Assuming that `seconds, minutes, hours, day-of-month, ..` the fourth * would result in the rule running every day at 1 am.

So I think that

0 0 0 1 * ?

Should be correct as "Every 1st day of any month, at 00:00".

 

Agreed that the "If" cannot be a JQL condition since JQL is an issue filter, not a universal value comparison device.

I would also note that CRON does support an optional 7th param for the specific year, so technically that could also be used as a substitute to the if condition, though it might probably be harder to structure the rule with that.

Suggest an answer

Log in or Sign up to answer