Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation: Detect the earliest date in child issues and copy it to the Epic

Amy Chang
Contributor
May 6, 2024

Hi Community,

 

If I add an issue to an Epic, how can I detect which child issue starts first and copy its Start Date to the Epic's Start Date?

 

Thank you!

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
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.
May 6, 2024

Hi @Amy Chang 

What have you done thus are to solve this need?

 

If you have an automation rule and it is not working as expected, please post an image of your complete rule, the audit log details, and describe what is not working.  Those will provide context for the community to offer suggestions.

 

If you have not started a rule, I recommend trying to do so.  This will help you learn more about rules and be better able to confirm the problem solved meets your needs.  Your rule could use the Lookup Issues action, with JQL, to gather the child issues of the epic, and then identify the earliest date with the min function, such as with:

{{lookupIssues.Start date.min}}

Before building the rule(s), I recommend confirming your understanding of what to do in several cases as additional rules may be needed.  What happens when...

  1. an issue is added to an Epic (your original question)
  2. an issue is removed from an Epic
  3. an issue is moved from one Epic to another (a special case combining #1 and #2, above)
  4. a child issue of an Epic is deleted
  5. a child issue's type is changed
  6. a Start Date is changed in a child issue of the Epic
  7. someone manually changes the Start Date in the Epic
  8. one (or more) of the child issues of the Epic are stored in a different Jira project than the Epic
  9. etc.

Kind regards,
Bill

Amy Chang
Contributor
May 14, 2024

Hi @Bill Sheboy 

Thank you for your reply.

I did this by comparing the start date of the trigger issue and the Epic. If the trigger issue's start date is less than the Epic's start date or the Epic's start date field is empty, it will copy the trigger issue value to the Epic.

Screenshot 2024-05-14 at 4.25.50 PM.png

However, I think the lookup issue action will be more precise. If I use the current method, even the system copies the value from the child issue, but we cannot guarantee that the date is the earliest date from the child issue.

 

I tried to use Smart Value Comparision to compare the original Epic ({{#changelog. epic link}}{{from}}{{/}}) and the new Epic ({{#changelog. epic link}}{{to}}{{/}}), and lookup the value from the new Epic if a child issue added in it. However, it doesn't work, and it seems the lookup action didn't support the Start date field. So I'm still figuring out how to read the child issues' Start Date when an issue is removed from an Epic.

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.
May 15, 2024

Are you using Jira Cloud, Server, or Data Center version?  If using Jira Cloud, the Lookup Issues action supports all current issue fields, including Start date.

And...the Epic Link field is sunsetting for linking Epics to their child issues in Jira Cloud.  Instead please use the parent field.

 

For the change of epic parent scenario, you could call Lookup Issues twice to update the two impacted epics...

To find the child issues of the current parent:

parent = {{triggerIssue.parent.key}}

To find the child issues of the previous parent, first confirm there was an old parent, and then use this JQL:

parent = {{#changelog.parent}}{{fromString}}{{/}}

 

 

0 votes
Yonghun Jeong
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!
May 14, 2025

Hi everyone, this is Jeong.
I ran into the exact same issue trying to update an Epic’s Start Date and End Date based on its child issues using lookupIssues. After lots of frustration with Branch: For JQL not executing (even when the issue key was correct), I finally found a workaround that works reliably within native Jira Automation—no apps, no webhooks.

What didn't work for me:
Using Branch: For JQL with key = {{lookupIssues.first.key}} → the branch wouldn't run, no matter what I tried
Creating a variable (smartFirstKey) and using it inside the JQL → same issue
Logging showed values were correct, but the branch simply skipped
What worked for me:
Use lookupIssues to get child issues of the Epic, sorted by date:
You should use customfield value, not like "Start date" or "End date".

"Epic Link" = {{issue.epic.key}} ORDER BY cf[11111] ASC

Use If: JQL condition instead of a branch:

key = {{lookupIssues.first.key}}

Inside that condition, create a variable:

Variable name : minDate
Smart value : {{issue.customfield_11111}}

Then, in a separate Epic branch, use that variable:

{ "fields": { "Start date": "{{minDate}}" } }
    or just do match them on UI console directly.

Do the same for End Date using lookupIssues.last.customfield_22222.
In End date case, change Start date(for example, customfield_11111) ASC to End date(for example, customfield_22222) DESC
Why this works:
If: JQL actually resolves smart values more reliably than Branch: For JQL
Creating the variable inside the conditional block ensures the value is set before you reference it
The Epic branch works because it’s related to the triggering issue and doesn’t depend on JQL parsing
Hope this helps someone else avoid the 6-hour debugging rabbit hole I just crawled out of!
Let me know if you want the full rule JSON—happy to share.

capture.png

ps. Atlassian, reflect on yourself.

0 votes
Amy Chang
Contributor
May 14, 2024

-

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events