Automation for Parent children due date

vince margaria November 26, 2024

Hello,

I am new to Jira automation and have a problem to make an automation that update a task due date if the sub-task created is a furthest date, here is a screenshot of my automation ( I work on Jira version 9.12.10

jira issue 1.png

And here is the audit log : jira issue 2.png

 

my current "Edit issue" is : "{{triggerIssue.customfield_12602}}" The problem is that this does only update the date based on the last subtask created. I tried with this :

{{lookupIssues.max(issue.customfield_12602)}} but it makes the due date field disappear. I am quite lost at what I should try next. Can someone help me please ?

2 answers

1 accepted

0 votes
Answer accepted
Dick
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.
November 27, 2024

Hi @vince margaria , Welcome to the Atlassian Community.

First step: Your trigger is quite wide, it allows the automation to run on epics, stories and sub-tasks. Each of these issuetypes would require a different approach, if I read your problem correctly:

  • if the due date of a story is updated, you want to evaluate the due dates of its subtasks to correct it to a later date if one or more of the sub-tasks has/have a later due-date. In this automation, the triggerIssue would be the story
  • If the due date of a sub-task is updated, you want to update the parent due date if the due-date of the subtask is a later date than the due date of its parent. In this case the triggerIssue would be the sub-task.

So these two cases might seem similar, the triggerIssue type is different, which requires prudence when you use the {{triggerIssue}} variable to navigate to the correct issues that need to be evaluated / changed.

Normally the trigger is accompanied by a selection statement like: if issuetype = sub-task. This would allow you to make two if-blocks dealing with the two approaches explained above in one automation, one for the sub-task triggering, one for the story triggering the automation.

Second step in your automation journey would be to get valuable log entries, as currently there are no values (requested issues) reported in your log. With the distinction above implemented, you should get better log values. 

One thing to know: after the for Parent branch, you should lookupIssues using issue, not the original triggerIssue (as that would be the sub-task triggering the automation)

Let's revisit after you changed the above,

Dick

Dick
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.
November 27, 2024

Meanwhile, I did a search and found a very nice way to get the maximum due date of a list of due dates. @Trudy Claspill was so kind to provide an answer that used this here;
Parent-issues-have-to-inherit-the-latest-due-date-of-child 

It is not a complete answer to your question, but its potential to help find the value that should be used to update the story due date is there.

Three cheers for Trudy!

Dick

 

Like vince margaria likes this
vince margaria November 27, 2024

Hello Dick,

 

I did a complete 180 and changed they way I do my automation to something like this : issue 3.png

This new method compare everytime there is a change in a children with the parent, if the child is greater, the parent take the change. This does not affect Epic or other issue type since I am using a custom field that is only in "Tasks" and "Story". issue 3.png
Here is my log. This seems to work well but I'm curious if you think the same as this is my first automation. If anything is badly translated sorry i'm non-native english

Like # people like this
Dick
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.
November 27, 2024

Hi @vince margaria 

No worries, I'm non-native as well (vous-êtes Francophone?) 
:)

Your automation takes care of occurrence number 1: A sub-task is edited.  

I think it is also necessary to do the calculation if the parent (story) is changed. It could very well be the case that the due date of the story is set to a different date. Then your should re-assess the due dates of the children of that story and perhaps even adjust the due date of the story. (that's occurrence number 2). 

You still need to distinguish between these two different parts of the automation by checking the issuetype of the triggerIssue and switch to the appropriate part of the automation.

Thanks for your enthusiasm,

Dick

vince margaria November 27, 2024

Hello @Dick 

Je suis en effet Francophone^^.

Thanks for the advices I will add theses as soon as I can, for now I will try to get some free time to learn correctly Automation, this tool is truly powerful but I don't really grasp what I'm doing at the moment. Once I get the opportunity I will update this post as well for the future admin asked to do this.

Like Dick likes this
Dick
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.
November 27, 2024

Hi @vince margaria 

As your automation is only capable of processing changes in subtasks being modified, you really should put a condition between trigger (green circle) and first action (blue circle): 

if issuetype = subtask

 

 

NomDuFils.png

 

 

Happy automating,

Dick

vince margaria November 27, 2024

Hello @Dick isssue 4.png

I did as you say and it works like a charm, thanks !

Like Dick likes this
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.
November 27, 2024

Hi @vince margaria -- Welcome to the Atlassian Community!

The solution approach you tried with Lookup Issues will not work for Jira Data Center as the lookup results do not include all issue fields.  Here is the suggestion to improve that: https://jira.atlassian.com/browse/JIRAAUTOSERVER-877

The workaround for that in your scenario is to remove the Lookup Issues action and instead use the Send Web Request action to call the REST API endpoint for an issue search with JQL.  Then use the web response smart value to find the maximum Due Date value.

 

Also, only checking when a subtask's Due Date field changes ignores several possible scenarios:

  • when a new subtask is added to the parent, and the subtask has the Due Date set during creation
  • when a subtask is removed from the parent
  • when a subtask changes to a new parent
  • when someone manually changes the Due Date in the parent, overriding the calculated value from the subtasks

Many of these could require additional rules, with different triggers and logic, although some of them may be combined.  The key is: how accurate do you want the parent's Due Date to be?

Kind regards,
Bill

vince margaria November 27, 2024

Hello @Bill Sheboy ,
In a perfect world I would like this automation to be perfect but unfortunatly i am hurried by time and principaly need an automation that work on creation / modification of children due date to the parent. I stopped using Lookup since I could not make it work, knowing that it comes from the fact I'm working on Data Center reassure me that I am not crazy.

You are correct about the fact that I need to adds error gestion to handle all differents scenarios.

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.
November 27, 2024

If you want to try the REST API approach, here are some references to help set that up:

 

How-to article for calling using the Send Web Request action:

https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

 

REST API endpoint to search for issues with JQL: 

https://docs.atlassian.com/software/jira/docs/api/REST/9.13.0/#api/2/search-search

vince margaria November 28, 2024

Hello @Bill Sheboy 

Thanks for the link I will look into it today.

Suggest an answer

Log in or Sign up to answer