How can I set a custom due date using automation?

Samuel Prathipaty
Contributor
November 18, 2024

Hi,

 

Our automation rule creates a few issues on a scheduled date. We want to set a fixed due date like November 30th, but the year should be based on the current year when the ticket is created. For example, if issues are created this year, the due date should be November 30, 2024. If issues are created next year, the due date should be set to November 30, 2025.

2 answers

1 accepted

2 votes
Answer accepted
Bill Sheboy
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.
November 18, 2024

Hi @Samuel Prathipaty 

You may do that in one step using the withAttribute() functions for date / time:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-with-attribute---

{{now.withMonthOfYear(11).withDayOfMonth(30)}}

 

Kind regards,
Bill

Samuel Prathipaty
Contributor
November 18, 2024

Hi @Bill Sheboy 

Thank you very much! It worked perfectly. This is exactly what I'm looking for.

Thank you,
Samuel

Like Bill Sheboy likes this
Richard November 19, 2024

Same here, I learned something new

Like # people like this
0 votes
Richard November 18, 2024

You may be able to create three variables:

1. Variable 1: "November 30, "

2. Variable 2: {{now.format("yyyy")}}        <--- returns the year only

3. Variable 3: {{Variable 1}}{{Variable 2}}

 

Richard November 18, 2024

Then enter {{Variable 3}} as the smart value in the field you want to set it

Samuel Prathipaty
Contributor
November 18, 2024

Hi Richard,

Thanks for your response. It is not working as expected. We are trying to achieve this for the due date system field. We have more than 10 tickets that will be created. How will this be set for all the issues?

Richard November 18, 2024

What is the date format that your system field for due date uses?

It may be dd/MMM/yy in which case you will need the following Automation Rules logic:

  1. Go to project settings for your project
  2. Click Automation
  3. Create New Automation Rule
  4. Trigger: When New Issue is Created
  5. Then: Create Variable 
    1. Variable Name: CurrentYear
    2. Smart value: {{now.format("yy")}}
  6. Then: Create Variable
    1. Variable Name: DayMonth
    2. Smart value: 30/Nov/
  7. Then: Create Variable
    1. Variable Name: DayMonthCurrentYear
    2. Smart value: {{DayMonth}}{{CurrentYear}}
  8. Then: Edit Issue
    1. Select the Due Date field
    2. Value: {{DayMonthCurrentYear}}

This should set the due date to Nov 30, for the current year when any issue is created. If you need this to only happen to a subset of issues, add an if statement after the Trigger.

Let me know if this works for you. 

Like Samuel Prathipaty likes this
Samuel Prathipaty
Contributor
November 18, 2024

@Richard Thank you for your solution. I appreciate you taking the time to help me.

Suggest an answer

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

Atlassian Community Events