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
...
Hello @Theresa
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.
{{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()
{{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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're welcome!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you show me the full automation ? I understand what to Put in the edit issues but not sure about the create variable
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
posted it in my original post
https://community.atlassian.com/t5/Jira-questions/Create-an-automation-for-Due-date/qaq-p/2738831
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.