Automation to change parent due date to next sub-task due date, once a sub-task is complete?

Lisa Stone July 8, 2021

I almost have this figured out, but can't quite get it.  Once a sub-task is marked complete, I would like the parent due date to change based on the NEXT sub-task due date.

I have figured out how to automate the change to the 1st sub-task due date, or the last due date, but can't figure out how to do the NEXT due date.  

So far I have:

Issue Transitioned to: Done

If: Parent exists

For Parent:

If: some sub-tasks are in status "To-Do" or "In Progress"

Then edit due date:  {{issue.subtasks.Due date.max}}

 

Using the above, I can update that smart value to "Max" or  "Min" to get the 1st due date of my subtasks or last, but is there any way to get it to figure out of all the sub-tasks which one has the next due date?

Thank you!

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.
July 9, 2021

Hi @Lisa Stone -- Welcome to the Atlassian Community!

I suspect this is possible, although it will be a more complicated solution.  But first to confirm: what do you mean by the "NEXT sub-task due date"?

Best regards,
Bill

Lisa Stone July 9, 2021

@Bill Sheboy - Thanks for your reply.  It would be whichever subtask has the nearest due date, that isn't already complete. For example:

Subtask 1 - Due July 9th -  COMPLETE

Subtask 2 - Due July 23 -  NEXT

Subtask 3 - Due August 6th

Subtask 4- Due August 18th  - LAST (Max)

Hopefully that makes sense.

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 9, 2021

Thanks; that's what I thought you meant.  :^)

The challenge is {{issue.subtasks}} smart value cannot sort; it can only see the min/max/average...

One work-around is to use JQL to get the subtasks in sorted order, yank out your due date, and then use it.  Perhaps like this by expanding on your rule:

  • trigger: issue transitioned to Done
  • condition: issueType is subtask
  • action: lookup issues on JQL to find the one with the next due date
project = myProject
AND statusCategory != Done
AND issueType=Sub-task
AND parent = {{triggerIssue.parent}}
AND duedate IS NOT EMPTY
ORDER BY duedate ASC
  • condition: are there subtasks remaining... {{lookupIssues.size|0}} is greater than 0
  • action: create variable varNextSubTaskDueDate initializing it to null
  • branch: on JQL to get at the subtask with... key={{lookupIssues.key.first()}}
    • action: create variable (again) to update the value of varNextSubTaskDueDate  to {{issue.duedate}}
  • condition: did you get a date... {{varNextSubTaskDueDate}} is not equal to null
  • branch: on JQL to update the parent with... key={{triggerIssue.parent}}
    • action: edit due date to {{varNextSubTaskDueDate}}

 

I encourage you to initially write to the audit to see the progress of values, and don't add the edit action until you have fully tested the rule.

Like Nikolai Kazintsev likes this
Lisa Stone July 9, 2021

@Bill Sheboy Thank you for taking the time to do that. I will definitely play around with that and see if I can get it to work.  

Like Bill Sheboy likes this

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