Automation to update parent due date based on earliest child due date

Ryan A July 13, 2021

Hello, 

 

I'm trying to figure out a way to update the due date of stories, to automatically reflect the earliest due date of any of its subtasks. 

 

Trigger: 

Due date of a subtask is changed

Branch:

The parent of that subtask (the story) 

Query: 

This is the part I'm struggling with

Action: 

Update the due date of the story to the earliest due date of all subtasks 

 

Is anyone able to offer a suggestion for the query? 

 

1 answer

0 votes
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.
July 13, 2021

Hi @Ryan A  -- Welcome to the Atlassian Community!

The challenge with a use case like this is scanning/finding the earliest date.  But first: I recommend creating a timeline/notes of what you expect to happen in various cases.  That will help when you test your solution.

One possible solution approach is using Lookup Issues and Created Variables, and their behaviors:

  • trigger: due date changed
  • condition: issue type is subtask
  • action: lookup issues with JQL to get all non-done subtasks with the same parent ORDER BY ascending due date
  • condition: did the lookup return any issues in order to proceed, {{lookupIssues.size|0}} is greater than 0
  • action: create variable for earliest date, initializing it to the string null
  • branch: with JQL on the first issue from the lookup, key = {{lookupIssues.first.key}}
    • action: create variable with the same name as above, and set it to the issue's due date.  This works because this branch returns one-and-only-one issue; otherwise the created variable method will not work.
  • condition: the created variable does not equal null
  • branch: on the trigger issue's parent
    • action: edit issue to update the due date to the value of the created variable

Best regards,
Bill

Suggest an answer

Log in or Sign up to answer