Forums

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

How can I set Jira automation to create a ticket with a due date of the 2nd Friday every month?

Kara Nadarajah
Contributor
August 6, 2024

I've created an automation which creates a ticket on the 1st of each month. The ticket needs to be populated with a due date which is the 2nd Friday of that month.

I've not been able to identify how to do this by looking at the existing documentation and questions. Please can someone help?

3 answers

1 accepted

0 votes
Answer accepted
Yi Meng
Contributor
January 2, 2025

You can set due date as {{now.ofTheMonth(2,5)}}

the 5th day of the 2nd week of the Month. Hope this is helpful.

Kara Nadarajah
Contributor
January 3, 2025

Thank you.

0 votes
Anandhi Arumugam _Cprime_
Community Champion
August 6, 2024

Hi @Kara Nadarajah I believe you have a scheduled trigger that creates an issue on the first day of every month. To the action that creates the issue, you need to set the value for the due date field. You need to choose the due date field from the options. Under the Due Date field, click on pick a date and set the value. Hope this helps.Automation - Set Due Date.png

Jakub Koc
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.
August 6, 2024

Yeah, you can set there date manually but in that case you would have to change it every month, there is no exact smart value to calculate 2nd friday of the month

Kara Nadarajah
Contributor
August 6, 2024

Thanks, I know how to set the due date but there is no option and no smart value in the documentation for setting '2nd Friday of each month'.

Anandhi Arumugam _Cprime_
Community Champion
August 6, 2024

@Kara Nadarajah Can you try something like

{{#=}}
startOfMonth().plusDays(
14 - startOfMonth().dayOfWeek().plus(1) % 7
)
{{/}}
Kara Nadarajah
Contributor
August 6, 2024

Thanks, i'd be grateful if you could explain what that formula is doing as I don't understand it and would be apprehensive to blindly apply it in case it doesn't work.

Anandhi Arumugam _Cprime_
Community Champion
August 6, 2024

 

The formula uses startOfMonth() that gives the first day of the current month. The dayOfWeek() gives the day of the week as a number (eg: Monday = 1, Sunday = 7). Then ,the formula calculates the offset needed to reach the first Friday, then adds 7 days to reach the second Friday. 
I recommend that you test this thoroughly before you implement. 

 

0 votes
Jakub Koc
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.
August 6, 2024

Currently what you are trying to achieve may be impossible and you would have to set the date manually, but maybe you can think of  something with the idea,

Scheduled automation that would run once a week on Friday and check if today's date is between 8 - 14 day of the month (using smart value) and do some action at that moment.

Though if someone needs to fill that out within that time I think setting up some custom SLA with reminders for that specific person or group would be a better solution

Jakub Koc
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.
August 6, 2024

@Kara Nadarajah  I believe this smartvalue will be answer for you

{{#if(equals(now.dayOfWeek==5))}}
{{now.plusDays(7).format("dd/MM/yyyy")}}
{{/}}

{{#if(not(now.dayOfWeek==5))}}
{{now.withNextDayOfWeek("FRI").plusDays(7).format("dd/MM/yyyy")}}
{{/}}



Smartvalue searches for the next friday, adds 7 days and prints the date in following format. First part is for when rule would be run at Friday then just add 7 days to that date, second part is for whenever the day when automation is run is not friday, then it would find the next friday, add 7 days to it. 
Hope that helps.

Suggest an answer

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

Atlassian Community Events