Set a child issue's "Due date" based on another child issue's status change date
Asked by Elif Alverson:

Hello,

Is it possible to set a epic's child issue's due date based on the same epic's another child issue's status change to "done" ? Here is what I have and it seems like there is a disconnect between the the two tasks of the same epic. Any suggestions? Thank you.

![Screenshot 2023-07-25 at 2.54.04 PM.png](/t5/image/serverpage/image-id/271097iF00FDF40DAA54F1A/image-dimensions/177x290?v=v2 "Screenshot 2023-07-25 at 2.54.04 PM.png")![Screenshot 2023-07-25 at 2.54.32 PM.png](/t5/image/serverpage/image-id/271098i5A7F08121466F938/image-dimensions/218x72?v=v2 "Screenshot 2023-07-25 at 2.54.32 PM.png")![Screenshot 2023-07-25 at 2.56.11 PM.png](/t5/image/serverpage/image-id/271099i008B59A338B1F31F/image-dimensions/294x103?v=v2 "Screenshot 2023-07-25 at 2.56.11 PM.png")


Answers:
author: Trudy Claspill
body: Hello [@Elif Alverson](/t5/user/viewprofilepage/user-id/4707500)

You have not selected the correct branch option. Notice the description of that branch.

![Screen Shot 2023-07-25 at 12.30.18 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/271111i1C4F0937E0E4813F/image-size/large?v=v2&px=999 "Screen Shot 2023-07-25 at 12.30.18 PM.png")

It works when the trigger issue is an Epic. Your trigger issue is the child issue of an Epic.

Do you expect to update more than one sibling issue?

To access the trigger issue's siblings you could use the Related Issues / JQL option to retrieve the sibling issues and iterate through them.

comments: author: Elif Alverson
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) , it works only for one child issue. I need two child issue's due date to be changed. I used JQL **summary \~ "Send Heading into Day 1 email" or summary \~ "test" ,**but it only works for the first task. What can I do this to work on the second ( maybe third task in the future)? Thanks you.


author: Elif Alverson
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) , this automation changes all the tasks with the summary **summary \~ "Send Heading into Day 1 email"**instead of the last one created. How can I block that and make it doable only for the latest created epic's tasks?


author: Trudy Claspill
body: Can you provide a fuller explanation of the use case with sample data, and the updated version of the rule that you have currently?


author: Elif Alverson
body: This is an automation for a department for the "Plan an Office Gathering" epic request (Example) with child tasks/subtasks. This epic is a template with a few tasks and subtasks associated with it. There are multiple of these epics/tasks/subtasks with the same summary field and they are sill not resolved. The request is to use one of the tasks resolved status date as the due dates of couple of other tasks. Here is the screen shots of the change and the audit details. Let me know, if it makes sense or have any questions. Thank you.

![Screenshot 2023-07-25 at 4.10.54 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/271118iB6A2B0F29F3DAE57/image-dimensions/347x160?v=v2 "Screenshot 2023-07-25 at 4.10.54 PM.png")![Screenshot 2023-07-25 at 4.10.39 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/271119i05EB42415C02549E/image-dimensions/346x142?v=v2 "Screenshot 2023-07-25 at 4.10.39 PM.png")


author: Trudy Claspill
body: One thing you need to do is add into the Branch JQL criteria to pick the siblings of the current issue; i.e.

"Epic Link" = {{triggerIssue.epic.key}}

As you have it currently written it will return all issues with matching summaries regardless of their parent epic. ;-)

You may also want to include criteria to exclude Epic and subtask types of issues, just in case they have a matching summary. Those should be excluded by the "Epic Link" criteria, so adding the issue type check to the JQL *shouldn't* be necessary.

Within a single epic would you expect the summary to match more than one issue? And, if so, would you want all the matching issue updated? If you don't want all the matching sibling issues updated, what do you use to decide which ones will be updated?


author: Elif Alverson
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) , added "Epic Link" = {{triggerIssue.epic.key}} to the automation and it created 28 of the same tasks ( Send Heading into Day 1 email and Test), set the due dates to now and closed them :) We use the same epic name for this Epic Template. Is that why there are 28 of these two tasks are created?

![Screenshot 2023-07-25 at 8.09.09 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/271153i17044105B9B86CA2/image-dimensions/230x114?v=v2 "Screenshot 2023-07-25 at 8.09.09 PM.png")![Screenshot 2023-07-25 at 8.09.27 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/271154i6489A804CBCD49B7/image-dimensions/308x151?v=v2 "Screenshot 2023-07-25 at 8.09.27 PM.png")

* Within a single epic would you expect the summary to match more than one issue? No, there is only one task or subtask with the same summary with in the epic. But we have numerous epics, tasks and subtasks with the same summary. The difference is the description, reporter, ticket creation date etc.


author: Elif Alverson
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) , I think the reason why there are 28 of the same tasks attached to the latest epic is ; there are total of 28 epic templates with the same epic name created and each one of them other than the last test one were closed. When I ran the automation, it carried all the closed tasks with the same summary field ( Send Heading into Day 1 email and Test ) to the latest epic.

What do you think?


author: Trudy Claspill
body: You did not edit the rule correctly. You needed to modify the JQL in the branch, not change the Edit Action.

> One thing you need to do is **add into the Branch JQL criteria** to pick the siblings of the current issue; i.e.
>
> "Epic Link" = {{triggerIssue.epic.key}}

![Screen Shot 2023-07-26 at 10.56.23 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/271349i57D0E77C9399A7AC/image-size/large?v=v2&px=999 "Screen Shot 2023-07-26 at 10.56.23 AM.png")

What your last change did was again select all the issue with a matching summary, regardless of their parent Epic (so, not getting just the siblings of the trigger issue), and then change all of them to be children of the parent Epic of the trigger issue.

You will need to modify each of those changed issues to assign them back to their original parent Epics.


author: Elif Alverson
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) , so all I need to change is to add

*summary \~ "Send Heading into Day 1 email" or summary \~ "test" and "Epic Link" = {{triggerIssue.epic.key}*

into the add into the Branch JQL criteria? This does not work.

![Screenshot 2023-07-26 at 2.40.10 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/271354iB9E7C8FE2460A7C0/image-dimensions/382x123?v=v2 "Screenshot 2023-07-26 at 2.40.10 PM.png")

P.S: I am testing this in the sandbox so no worries about the due dates etc. Thank you.


author: Trudy Claspill
body: You left off the second closing curly brace:

{{triggerIssue.epic.key}**}**

Additionally I recommend putting the OR conditions in parentheses:

(summary \~ .... OR summary \~ ...) AND "Epic Link" = {{triggerIssue.epic.key}}

That will ensure that all the retrieved issues must be children of the same epic as the trigger issue, and then pare that list down to the ones with matching Summary values.


author: Elif Alverson
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) , It is working. Thank you so much as always. I have two questions.

1. When I run the JQL (**summary \~ "Send Heading into Day 1 email" or summary \~ "Test") AND "Epic Link" = {{triggerIssue.epic.key}}** in the filters section I get the message of **"Error in the JQL Query: The character '{' is a reserved JQL character. You must enclose it in a string or use the escape '\\u007b' instead. (line 1, character 93)" .**How come it works in the automation while it does not in the filter section?
2. I need due date to be set to **5 days after the trigger task is closed**. What would be the smart value for that expression?

![Screenshot 2023-07-26 at 8.22.50 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/271416i4E25FB7D882F86BD/image-size/large?v=v2&px=999 "Screenshot 2023-07-26 at 8.22.50 PM.png")


author: Trudy Claspill
body: 1. Because the syntax for JQL within an Automation rule recognizes smart values, which are encapsulated in curly braces. Standard JQL syntax elsewhere can't interpret smart values and so can't deal with the syntax

2. If you look here

<https://support.atlassian.com/cloud-automation/docs/smart-values-in-jira-automation/>

You'll find a link to a page about smart value options related to date and time values. On that page you will find a variety of functions you can use with date/time fields and smart values. You'll want to look at the **.plus\[Unit\]** function. If your field is just a date field vs. date/time field then you may also need to look at the formatting functions to convert the date/time value of **now**to just a date.


author: Elif Alverson
body: [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011) , thanks for the documentation and all the help. Smart value is "{{now.plusBusinessDays(5)}} ".


Tags: automation

cloud

due-date

epic

jira-work-management-cloud

resolution

task