Forums

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

Use automation to create monthly change tickets for maintenance

Stian Bentsen Sveen
Contributor
August 1, 2024

Hi,

I created an automation rule for a colleague.

They have regular maintenance for certain servers each month.

Its always done the third Tuesday of each month and then there's another "follow up" task for the third Wednesday each month, in case there are some follow up to do after the maintenance.

I setup an automation that runs on the first day of the month to create these Change requests using these smart values for Planned start and Planned end date:

{{now.withHour(xx).withMinute(00).ofTheMonth(3, 2)}}

and

{{now.withHour(xx).withMinute(00).ofTheMonth(3, 3)}}

 

This worked fine, except when you have months where f.ex the third Wednesday of the month is a week before the third Tuesday....

Im sure there are multiple ways to get around this, but my heads stuck in a loop.

Since this can happen from time to time, it would be better if the "follow up" change could be created with Planned start / end with the same as the first one but +1 day, but im not sure how to do that.

The other idea would be to have an automation for the second ticket that triggers on the Planned start date for the first one and then just uses current time +1 day (but I would only want it to trigger on those Changes and not all issue type "Change".

How should I do this?

 

1 answer

0 votes
Jim Knepley - ReleaseTEAM
Atlassian Partner
August 1, 2024

A situation I see where that can happen is if the 1st of the month is a Wednesday. Maybe think of it as "Tuesday of the third week of the month" as opposed to "third Tuesday." This would let you use the plusWeeks() operation, then find the Tuesday or Wednesday of that week, as appropriate.

ref: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

(The rabbit hole of the definition of the "first week of the month" is quite the trip. I choose to define it as the week that contains the first day of the month.)

The trick to that approach would be to be to compute the fist Monday, maybe conditionally adjusting the date based on something like:

{{#if(now.startOfMonth.isBefore(now.withNextDayOfWeek("TUE")}}

Suggest an answer

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

Atlassian Community Events