Forums

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

Max/min date of any child under an epic. Smart values.

Rafal Wzorek April 22, 2024

Premise: to update epic due date to align with latest due date of child user stories.

Trigger: field due date of any of constituent user story is changed.

Condition: IF current epic's due date is different to max due date of ANY child user story (including the triggering issue and it's new value), THEN update the epic to the max value.

Comment: This should work for both extending or shortening the overall epic's duration based on changed to user stories in it. I could apply the same for star dates. 
I need to know how to target all child items of a parent of a current (triggering) issue, and how to perform max/min check on this. 

 

 

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Trudy Claspill
Community Champion
April 22, 2024

Hello @Rafal Wzorek 

Welcome to the Atlassian community.

After your trigger add a brach -  For Each: Related Issue: Parent 

That will change the focus to the parent issue of the trigger issue.

Within the branch use a Lookup Issues action to execute a search for all the child issues of that parent using JQL

parent={{issue.key}} and "Due date" is not empty

Then you can find the max or min of a date field in the returned issue using the min and max functions:

{{lookupIssues.Due date.max}}

You can compare that to other values (use the Smart Value condition) and use it to set the value of a field in an Edit action.

You can see an example of this on my answer to this other post:

https://community.atlassian.com/t5/Jira-Software-questions/Parent-issues-have-to-inherit-the-latest-due-date-of-child/qaq-p/2533974

Rafal Wzorek April 23, 2024

That's great. I have edited this reply few times, but it boils now to 2 things. I was able to make it "work" whereby updating any child would update the parent epic (using Timeline view, which is great), however:

  • I am struggling to add IF check before Edit Issue Fields action to ensure I am not updating parent unnecessarily - I used Smart Values condition action to check {{issue.duedate}} (i.e. the parent) LESS THAN {{lookupissues.duedate.max}} - on execution details I see that parent did not match the condition
  • On the Edit issue Fields action when I choose "due date (System)" field, it does work, e.g. it updates it visually on Timeline, however the "due date" field as see in issue details page becomes blank - and issue history shows automation changed if from whatever the previous value to blank?
Trudy Claspill
Community Champion
April 23, 2024

Can you provide screen images that show the complete rule and the details of each step?

And can you provide the details from the rule execution Audit Log entry for executions where something unexpected happened?

An excellent debugging tool is the Log action. With the Log action you can print information into the Audit Log during the rule execution. I use this liberally to print out the current values in issue fields and to print out any other smart values I'm using. It helps me confirm that the data in those fields/smart values is what I expect it to be. If you are trying to print out issue field values after steps where the values were changed make sure that you add a Re-fetch Issues action to get the current information for the issue first.

Like # people like this
Rafal Wzorek April 26, 2024

Thanks for following up. First I wanted to reconcile smart value variables. I've added log action as per below but I don't see the results in Action log (in the Automation section, or is it the wrong place?)jirr2.png

Rafal Wzorek April 26, 2024

As for the current flow and the actions I have the following. The IF conditions results in no matches, when I remove it it runs and makes parent due date blank.

I wrote a lengthy response but I realised the culprit is probably an incorrect "duedate" field I am using in the initial lookup - a field simply called "duedate" - which is probably incorrect/blank, thus all the results are not working and parent is updated with max value among blank values, also blank!

In "Edit issue" where I can choose field from the list, there is "Due date (System)" and "(Due date (datepicker)" (I use the first one which seem to update the right field). In JQL, I see suggestions for "Due", "duedate", and "Due date", and the first two work as expected (last one may be from a plugin). 

So I wonder if they are called the same in smartvalues - although checking documentation it appears it's just "duedate":

{{issue.duedate}} - Returns the issue's due date  

jirasetup1.jpg

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.
April 26, 2024

Hi @Rafal Wzorek 

The cause of the problems seems to be there are multiple fields with the same name causing confusion in rule processing.  What is the purpose of the added custom field?

Additionally, the built-in "Due Date" field has multiple smart values that work in rules and so that could cause further confusion with that extra field.

Kind regards,
Bill

0 votes
SilkeS
Community Manager
Community Managers are Atlassian Team members who specifically run and moderate Atlassian communities. Feel free to say hello!
May 14, 2025

This topic has been locked because the thread has become a bit dated. If you’d like to keep the conversation going or have additional questions, we encourage you to start a new topic. You can read more about necro posting (“raising threads from the dead”) in our Community Guidelines.
Thanks!

0 votes
Yonghun Jeong 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:

  1. 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
  2. Use If: JQL condition instead of a branch:
    key = {{lookupIssues.first.key}}
  3. Inside that condition, create a variable:
    Variable name : minDate
    Smart value : {{issue.customfield_11111}}
  4. Then, in a separate Epic branch, use that variable:
    { "fields": { "Start date": "{{minDate}}" } }
        or just do match them on UI console directly.
  5. 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.

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
STANDARD
TAGS
AUG Leaders

Atlassian Community Events