Can I automatically set the due date of a parent issue to the maximum due date among all sub tasks?

andreas
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 24, 2016

Whenever a sub-task's due date is edited, I'd like to update the parent's due date if the sub-task's due date is later then the current due date of the parent (and all other sub-tasks).

3 answers

1 accepted

2 votes
Answer accepted
andreas
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 24, 2016
So this automation rule is a bit crazy, but it is *actually* possible to do this.  Here's a screenshot of the rule in action:
set-due-date-tomax.png
Let me break this down:
  • First we have an issue updated trigger
  • Next we have a condition to check that the issue's duedate was updated by checking that {{#changelog.duedate}}{{toString}}{{/changelog.duedate}} is not empty
  • Next we run a JQL condition to check it was a sub-task we edited
  • And then we have a related issues condition that checks all other sub-tasks and parent (excluding the current issue) to see if they all have due dates before the current issue.  So first we lookup siblings and parent using: parent = {{issue.parent.key}} and key != {{issue.key}} OR key = {{issue.parent.key}}
    Then we check that all of them match: duedate is empty OR duedate < '{{#issue.fields.duedate}}format="jqlDate"{{/issue.fields.duedate}}'
  • If that's true, then we edit the parent issue and set its duedate to the due date of the issue that triggered the rule chain using this advanced JSON:

    {
       "fields": {
         "duedate":"{{#triggerIssue.fields.duedate}}format=\"jiraDate\"{{/triggerIssue.fields.duedate}}"
       }
    }

 

Here's a screenshot of just the related issues condition as well:
related-condition.png
This is a pretty advanced use-case for Automation for JIRA and not quite as simple as we'd like it to be yet!  
marcelo@zulimar.ca October 2, 2018

Does it work also for epics when one of its stories has the due date changed?

 

Like this:

This is an epic that has its due date set to 10/24

dueDate_dynamic.PNG

BUT inside of it there is a story whose the due date is 10/25.dueDate_dynamic01.PNG

 

Can you confirm? Thanks in advance

Best

0 votes
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2021

Here is a warning that folks often overlook when using this kind of approach.

If the due date for an issue is cleared, the algorithm should ensure that all other relevant issues with due dates are scanned, to ensure that the desired date is reflected in the target issue.

Consider the case where an issue had its due date set to October, and it was cleared (perhaps to indicate that the due date is now unknown).

If that was the oldest date, then the parent issue would have been previously set to that date in October. But what if all the siblings were set to a date in September? The parent should get reset to the latest Sept date.

Since andreas' screen shot is lost, we can't be sure exactly how his rule was configured. However, the second bullet point in the text description says to terminate the rule early if the triggering issue's new due date is empty. This is exactly the case I outline above, and shouldn't be ignored.

0 votes
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2021

There is a new way to do this, since mid-2020, as announced here:

https://community.atlassian.com/t5/Automation-articles/New-automation-smart-values-in-Jira-Cloud/ba-p/1402775

Essentially you can write:

{{issue.subtasks.Due date.max}}

as a smart value, simply setting the Due Date for a Story or Task to that.

Unfortunately there is NOT a parallel way to access issues under an Epic. This only works for Sub-tasks.

P.S. Isn't it cheating to answer your own question, andreas?

Suggest an answer

Log in or Sign up to answer