Transition Parent (Epic) to done when tasks are done

Jorge July 23, 2020

Hello,

I am trying to create a rule to transition a parent (epic) if all tasks are done by doing this:

Jira Aut_01.png

When I moved the last task to done to trigger this rule, it does not take action on the parent. I don't think is getting to then. I'm doing something wrong or I'm missing something, help please. Thank you!

1 answer

1 accepted

2 votes
Answer accepted
Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2020

Hello @Jorge 

 

Thanks for writing to us. You want to work on all types of subtasks(stories, bugs, tasks, etc) present in an Epic, for that you will have to use Epic(parent) branch condition which loops over all the issues(linked or child tasks) present in this epic. In your case, parent -> sub-task relation did not hold true hence it did not work as you expected.

I would recommend to plan rule like this:

Screen Shot 2020-07-24 at 12.01.01 pm.png

 

Hope this helps!

Cheers
Sherry

Jorge July 24, 2020

Hi Sherry,

Thank you for your answer. I made the changes and still there was no action happening.  So I went and read in more detail your suggestion and check why, the parent I was using was not the right one, EPIC(Parent) once I changed that, worked. Now, the workflow has a rule to include time spent before moving to done so now I will need to add all the time spent of the tasks in the epic and update the timeSpent field  ;)

Thank you for your help,

JorgeJira Aut_03.png

 

Jorge July 24, 2020

Hi Sherry,

I'm entering this code in the "Then" part of the script but is giving me an error indicating: Invalid type duration entered. Any suggestions on how I can get the sum of all the time spent of each task in the epic? 

{
"update": {
"worklog" : [
{
"add": {
"timeSpent" : "{{now.diff(issue.created).businessDays}}d"
}
}
]
}
}Jira Aut_04.png

 

Thanks,

Jorge

Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 26, 2020

Hi @Jorge 

For finding sum of worklogs in an epic, there is an article published: https://community.atlassian.com/t5/Automation-articles/How-to-sum-up-logged-hours-using-automation-in-Jira-Cloud/ba-p/1409115
You can refer above article and in the comment you can see how we can do it in an epic(which sums up original estimate of all stories inside epic set it to parent epic. 
I would suggest to go for separate rule with trigger as "When Value Changes".

But in your case if you want to calculate "time spent" on the basis of dates created and date marked as done, the way you are doing is fine. I think issue is with the smart value.
Try using: "{{issue.created.diff(now).businessDays}}d" (Your case is generating negative value and worklog can not take negative time spent)

I would recommend to use "Log Work" action(at last in your rule) over setting it in json. Looks more clearer, readable and easy to edit. Something like this:

Screen Shot 2020-07-27 at 11.39.17 am.png

Hope this helps!

Cheers
Sherry

Like Sebastian Mühleis likes this
Jorge September 11, 2020

Hi,

I came a cross a scenario where this rule is not performing as expected. Let me describe my situation I hope it make sense:

I have a jira board for development and a kanban board for QA. So far I have done automation to clone an issue from the dev's board to the kanban. Once QA moves the clone task to done, then a rule will be triggered and will move the linked issue (original) to done as well. So all this works wonderfully if they are 1 to 1. 

My last scenario is when I have an epic and it's in progress, one subtask gets ready for QA it gets duplicated, wonderful, then QA finishes moves the cloned to done, then the  original subtask moves to Done, perfect but then this subtask should trigger again the rule and get the epic parent move to Done as well since all children tasks are done.

Should I duplicate the rule and see if it gets triggered and moves the Epic Parent of the original subtask to done as well? 

Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 13, 2020

Hello @Jorge 

 

Maybe you can refer rule here: https://docs.automationforjira.com/rule-playground/index.html#/rule/112177/12212069 which does something similar to closing parent tasks if all child tasks are done. IF this still not resolves, please share your rule and audit logs so that I can take a look.

 

Cheers
Sherry

Jorge September 14, 2020

Hi Sherry,

Thank you for your reply and help. I did the changes, following the rule and there is something wrong, I get an error. Attach is the screenshot so you know what I'm entering. Maybe I have entered something wrong but I cannot see where. Thank you again for your help.

Jira Issue - Sep 14 2020.png

Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 14, 2020

Hello @Jorge 

Seems like in your case parent-child relationship does not hold true, that's why "For Parent" branch condition is failing. Can you try choosing "Epic(Parent)" from drop down instead of "Parent" to find the epic? Also, the condition "Sub-tasks match" , maybe you can try "Stories (or other issues in this Epic)" instead if that fits your use case.

 

Thanks
Sherry

Suggest an answer

Log in or Sign up to answer