Updating start and due date on a parent from its subtasks

Giorgos Kavvadias
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!
August 12, 2021

Hello there,

I am currently having my own structure of issues which looks like above:

|-Epic
|--- Level 1 (type of story)
|------ Level 2 (type of subtask)

What I wish to do, is to update the start and due dates at level 1 based on the dates of level 2 subtasks.
More specifically, I wish to have as start date at level 1 the earliest start date of subtasks at level 2, and as due date at level 1 the latest due date of subtasks at level 2.
Is this something doable?

In addition, would the change be huge if in a next step I would like to do the same in the level of an epic using the dates of level 1 tasks?

I have already read this post: https://community.atlassian.com/t5/Jira-Software-questions/Jira-Automation-Parent-issue-due-date-based-on-children-issues/qaq-p/1592692 but I cannot say it was clear enough to me, since I am new at automation.

Note: I am using the cloud version

1 answer

1 accepted

2 votes
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.
August 12, 2021

Hi @Giorgos Kavvadias -- Welcome to the Atlassian Community!

You can do this with automation for Jira (A4J), and what may help is to read a bit about A4J and look at some example rules first.  That will give you context before creating your rule(s).

So first, please take a look here:

Next, for your specific use case: you will want to define what you want to happen when dates change.  For example, what happens when the dates get cleared versus updated? 

Once you decide the edge and test cases, you can build a rule.  Perhaps something like this for your Level 2 -> Level 3 layer, which uses searches on the sub-tasks (Level 3) to get the min/max dates.  This example assumes no blank dates, so consider how to handle those.

  • trigger: start date or due date change
  • condition: issue type is your Level 3
  • action: lookup issues with JQL to find all Level 3 issues with the same parent as the trigger issue, ordered by the Start Date ascending
  • branch: on JQL for the earliest Start Date, key = {{lookupIssues.key.first}}
    • action: create a variable to save the {{issue.Start Date}}
  • action: lookup issues with JQL to find all Level 3 issues with the same parent as the trigger issue, ordered by the Due Date ascending
  • branch: on JQL for the latest Due Date, key = {{lookupIssues.key.last}}
    • action: create another variable to save the {{issue.dueDate}}
  • branch: on the parent of the trigger issue
    • action: edit start date and due date to the created variables

This example handles dates moving earlier or later.  If you only expect Start Date to get earlier and Due Date to only get later, the rule can be made much simpler.

Making a rule for your Level 1 (epic) to Level 2 would be similar.  At this time, I do not believe it is possible to do both in one rule as branches cannot be nested.

Best regards,
Bill

Giorgos Kavvadias
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!
August 13, 2021

Hello @Bill Sheboy ,

Thank you for your answer, I will review the articles mentioned!

Like Bill Sheboy likes this
uri_shani January 27, 2022

Hi - hoping someone can share a screen show of the rule / automating built here (especially for the JOL parts in the explanation) 

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.
January 27, 2022

Hi @uri_shani -- Welcome to the Atlassian Community!

I provided those JQL details in my text description of such a rule, but the specifics will depend upon the fields/values you are using. 

Have you tried to create the rule yet?  If so, please post images of your rule and audit log details, and what you believe is not working as expected.  That will provide the community context to offer ideas.  Thanks!

Kind regards,
Bill

Alex Borges da Silva
Contributor
January 27, 2022

Hello @Bill Sheboy !
I am trying to follow the steps you mentioned but I'm locked behind a few walls right now... Could you assist me?

First of all to be honest, I'm quite new to Jira, administration and automation.

Now, when you show: key = {{lookupIssues.key.first}}
Is Key something that should be changed? If so, how can I get my specific field key?
i.e. Here we have the "Start Date[Date]" field, and I am blocked off from editing it.

Query: "Start date[Date]" = {{lookupIssues.StartDate[Date].first}}

The Log Error (it's in portuguese so i translated and bolded what I changed):

"G2CL-70: "(("Start date[Date]" = ) AND (key != G2CL-70)) AND (project in (10222))" - Error in JQL query: Expecting a value, list or function, but returned ')'. You should place ')' between ' to use it as a value. (line 1, character 24)"

What I understand from it is that it returned either ")" or a kind of blank from

"Start date[Date]" = {{lookupIssues.StartDate[Date].first}}

Tryed with "key" instead of start date, similar error.

 

The second topic I'm in trouble with the search for all the level x items within a parent.

 

I kwow it's a lot to ask for, but I think that solving these 2 points will result in finishing the rule, or getting really close to.

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.
January 27, 2022

Hi @Alex Borges da Silva -- Welcome to the Atlassian Community!

First thing: for a new question like this I recommend creating a new question, and adding a link to this prior thread.  That will ensure the most people see it to offer ideas.

Next, for automation questions please post images of your rule and the audit log details.  That will provide context for people to help.

 

Based on what you described thus far, here are some thoughts:

Lookup Issues returns a list of zero-to-many issues (up to 100) meeting your JQL criteria.  That means you can use the list functions to access the issues: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/

When I noted using .first that was to get the first returned issue.  Instead it appears you want the issue with the earliest "Start date[Date]" value.  You have two options:

  • If you just need the earliest date for the issues, try {{lookupIssues.Start date.min}} to get the minimum
  • If instead you want the entire issue with the earliest start date, you should order your Lookup Issues JQL results accordingly.  Please update the example JQL to match your needs.
    • the JQL could be project = myProjectName AND some other criteria ORDER BY "Start date[Date]" ASC
    • Then to get the first issue's data, use {{lookupIssues.first.Start date}}

 

For your next question about "the search for all the level x items within a parent", JQL can find the issues immediately above/below (or linked) to an issue.  It cannot arbitrarily find issues at level-x.  There are custom apps in the marketplace to add this feature.  Again, without seeing the specifics of your rule I cannot offer other ideas on this question.

 

Kind regards,
Bill

Like Alex Borges da Silva likes this
Alex Borges da Silva
Contributor
January 28, 2022

Dear @Bill Sheboy 

 

First of all thank you for your answer.

Secondly, I've started a new thread and tried to describe the problem even further.

https://community.atlassian.com/t5/Jira-Software-questions/Change-parant-dates-based-on-child-s-date-A4J/qaq-p/1926707#M182277

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer