How to copy a custom due date field and update the year

Jacquelyn Mosby November 26, 2024

Hello!

I am trying to build an manual automation rule that, when triggered, will create a new issue and copy certain fields. One of those fields is a custom date field called "Subscription Renewal Date". I would like to copy over the Month and Day, but update the year. For example, we have an software renewal for this year (2024) with a Subscription Renewal Date of 12/01/2024, and once that subscription is renewed, the manual automation rule would be triggered to create a new issue for next year (2025) to track the renewal. So I would like to copy the Subscription Renewal Date over to the new issue but update year to 2025, so the new date would be 12/01/2025. How can I achieve this?

 

Thanks!

Jacquelyn

1 answer

1 accepted

1 vote
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 26, 2024

Hi @Jacquelyn Mosby -- Welcome to the Atlassian Community!

Please try using either of these functions:

plusYears() function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-plus-unit---

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

Kind regards,
Bill

Jacquelyn Mosby November 26, 2024

Thank you for your reply! Would I need to add that in the "Additional Fields" section? And is this the correct format: {{issue.customfield_10187.withYear(2025)}} ?

 

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 26, 2024

You should not need to use advanced edit with JSON. 

Instead, you may try typing / copy-and-pasting that expression directly in the field for the Edit Issues action.  When the expression appears below the field, select it for use in the edit.

 

Re-reading your original question: do you want to "set" the year or "increment" it from the field's current year?

Jacquelyn Mosby December 2, 2024

@Bill Sheboy I am not sure I understand your question completely, but I would like date in the newly created issue to have the same month and day as the current issue, but set the year to the following year. So if the subscription renewal date for this year was 12/01/2024, the subscription renewal date for next year should be 12/01/2025. 

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.
December 2, 2024

It appears you always want to increment the year, and so try pasting this directly in the field with the edit action:

{{issue.customfield_10187.plusYears(1)}}

 That will appear below the field in the Edit Issue action, and then it may be selected for use.

Jacquelyn Mosby December 20, 2024

@Bill Sheboy Apologies for the delay! That suggestion did the trick - thanks for your help!

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events