Change due date of story/issue when epic due date changes, while keeping the difference in days.

Theresa June 10, 2024

This question has been asked, but I don't understand the answers. I'm new to Jira, and I'm trying to learn how to automate the change of my story/issue due dates when the epic due date changes. 

For example, if my epic's due date is August 31st and my story's due date is August 20th, how do I automate it so that if I change my epic's due date to August 29th, my story's due date will automatically change to August 18th? I got to the point where I edit the story/issue due dates when the epic due date changes, but I don't know how to add the delta between the dates. 

When value changes for due date

issue type equals epic

branch for stories (or other issues in Epic)

Then Edit issues fields due date

...

1 answer

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2024

Hello @Theresa Monterroso 

Welcome to the Atlassian community.

In order to change the child issue by the same amount as the Epic was changed, you have to calculate the difference between what the Epic's original Due Date was and its new Due Date.

With the Field Value Changed trigger you can reference the fields original value with a special smart value

{{fieldChange.fromString}}

And you can reference the new value with

{{fieldChange.toString}}

https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Field-value-changed

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

 

These are stored as strings. To convert them to dates you use the toDate function.

{{fieldChange.fromString.toDate}}

{{fieldChange.toString.toDate}}

 

To find the difference between two dates you use the diff() function, set the time units you want that difference expressed in.

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

{{date1.diff(date2).units}}

In your case to get the difference in days you would use:

{{fieldChange.fromString.toDate.diff(fieldChange.toString.toDate).days}}

At this point you have the days of difference between the Epic's previous Due Date and its current Due Date.

 

Now you want to apply that difference to the Due Date in the child issue. In your Edit action you use another smart value and function to set the new value of the Due Date for the child issues.

The function to use is plusDays()

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

{{date_field.plusDays(# of days)}}

date_field is replaced by issue.duedate

# of days is replaced by the smart value I mentioned above that calculate the difference in days for the Epic's Due Date.

{{issue.duedate.plusDays(fieldChange.fromString.toDate.diff(fieldChange.toString.toDate).days)}}

 

Put that whole string directly into the entry field in the Edit action for updating the Due date field.

Screenshot 2024-06-10 at 5.12.46 PM.png

Theresa June 11, 2024

I'm so sorry, but I don't understand this. Can you post the automation?

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 11, 2024

What exactly do you not understand?

 

You have all the steps already.

When value changes for due date

issue type equals epic

branch for stories (or other issues in Epic)

Then Edit issues fields due date

 

In your original post you said:

but I don't know how to add the delta between the dates.

That is the information I provided. You just need to add what I provided in your Edit Issue step.

If that is unclear, show us the automation rule you have created so far.

Theresa June 26, 2024

Sorry, still learning. I was able to get this. Thank you!

Like Trudy Claspill likes this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 26, 2024

You're welcome!

DELACRUZ Guerdly _Gigi_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2024

Could you show me the full automation ? I understand what to Put in the edit issues but not sure about the create variable 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2024

Hello @DELACRUZ Guerdly _Gigi_ 

I assume this is related to your post here:

https://community.atlassian.com/t5/Jira-questions/Create-an-automation-for-Due-date/qaq-p/2738831

...where I recommended you look at this post.

You don't actually have to create a variable.

In your original post please show the entire automation rule you have constructed so far, and we can offer you advice specific to your situation.

DELACRUZ Guerdly _Gigi_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2024

Suggest an answer

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

Atlassian Community Events