How to automate parent transition when a number of sub-tasks is closed
Asked by George Stamos:

Hello everyone,

First of all I would like to know if what I'm trying to do is feasible with Jira project automation.

Use case: Having a story with a number of sub-tasks (i.e. child issues) I would like to automate the transition of the Story (i.e. parent issue) when all sub-tasks with Design component for example are move to Done i.e. when all orange sub-tasks (or last orange) are moved to Done. Is this possible? If yes, how can I manage this?

So far I know how to move my story for example to Design as soon as the first sub-task moves to In Progress. I also know how to move my story when all sub-tasks moved to Done. What I cannot figure out is how to transition my story when a sub-set of my sub-tasks is moved to Done.

Thank you in advance,

George

![jira_aut_query.png](https://community.atlassian.com/t5/image/serverpage/image-id/187991iB6373A85D9B18CB7/image-size/large?v=v2&px=999 "jira_aut_query.png")


Answers:
author: Stefan Salzl
body: Hi [@George Stamos](/t5/user/viewprofilepage/user-id/284103) ,

Do the subtasks have the field "Component" filled with component "Design"? Or is color the only way the are detected as Design issues?

Best  
Stefan

comments: author: Stefan Salzl
body: In case there is a component "Design" in the SubTasks the following rule should do the work as expected:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/188028iBCA43D4C078FBCF4/image-size/large?v=v2&px=999 "image.png")

Looking forward to your feedback.

Best  
Stefan


author: George Stamos
body: Color coding was for the sketch :). It is component as you thought so. I forgot to mention I'm on a data center not cloud though :(.

I'll give it a try to see if i understood correct and let you know.

Thank you for sharing [Stefan Salzl](https://community.atlassian.com/t5/user/viewprofilepage/user-id/4616993)


author: Stefan Salzl
body: hi [@George Stamos](/t5/user/viewprofilepage/user-id/284103)

thanks for the information. That's a game changer as the lookupIssue action is not available for data center ?

need to rethink the solution ?

Best  
Stefan


author: George Stamos
body: Thank you [@Stefan Salzl](/t5/user/viewprofilepage/user-id/4616993) any ideas are more than welcome. Its been two days now I cannot take this out of my mind ?


author: Stefan Salzl
body: Oh man I feel you. This is nerve wrecking ????

I'll give it another shot today ??


author: George Stamos
body: My use case is related to Kanban and metrics I get from Stories (i.e. cycle time in status) so I don't want to forget them as they will mess-up my metrics but it seems I will have to do a manual check on a daily basis to have realistic metrics.

So, for the moment not knowing if this is possible or not, it really keeps me awake in the night :) ?


author: Stefan Salzl
body: hmm.....got your point and why this keeps you awake at night ?

Would it be sufficient if this action runs once or twice a day? The rule could then start with a JQL that checks stories.

Otherwise I guess a workaround for the lookupIssue could be a webhook to JIRA API in the automation rule.

Best  
Stefan


author: George Stamos
body: I think this the issue, even what you describe is not possible or still i didn't figure out how to do it.

Keeping me up in the night :) it is just me getting frustrated not being able to solve this riddle which actually looked simple in the beginning.


author: Stefan Salzl
body: Guess I found a solution. tbh: it?s not the simplest one but in my tests it worked.

see screenshot:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/188320i0CD4A135519C93FD/image-size/large?v=v2&px=999 "image.png")

Hope this helps (and brings back some more hours of sleep ??),

Looking forward to your feedback.

Best  
Stefan


author: Bill Sheboy
body: Hi [@Stefan Salzl](/t5/user/viewprofilepage/user-id/4616993)

There may be another way to do this with Server/Data Center that does not require the web request / REST API call is with delegation:

* tell the parent to perform the check by adding a "hey do this" comment to the parent, and
* use a second rule triggered on the comment (with "Allow Rule Trigger" enabled in the rule details).
* In that second rule, the parent may then use a related-issue condition to decide if the subtasks indicate transitioning the parent.

Kind regards,  
Bill


author: Stefan Salzl
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) omg.....THIS seems quite a lot easier than my solution ??

Anyways it was quite a big journey of learning new things and "getting familiar" with API calls ?

Thanks for your valuable hint.


author: George Stamos
body: Hello [@Stefan Salzl](/t5/user/viewprofilepage/user-id/4616993) ,

I did implement your proposal above and got an error 500.

Didn't have the time to trouble shoot though. I will check tomorrow but maybe I start with [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) proposal ?

I will let you know and share the results here. Thank you both


author: Bill Sheboy
body: Hi [@George Stamos](/t5/user/viewprofilepage/user-id/284103)

Would you please clarify something about your use case? That may help the community to offer you suggestions to help.

You describe a need to move the parent story to "done" when a subset of the child subtasks (e.g. the orange ones in your picture) are all "done".

What work do the "blue" subtasks represent that they do not also need to complete for the story to be considered complete? For example, are they optional and so are abandoned when the "orange" ones are all completed?

Kind regards,  
Bill

comments: author: George Stamos
body: Hello [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) ,

As shown in the picture, I want to move my story I.e. parent to the next flow step when a subset of my sub-tasks is moved to done.


author: Bill Sheboy
body: Thanks and I understood that from your picture.

I was asking: **why would the other subtasks not need to also finish before marking the story as "done"**?

Is your intention work would continue on the other subtasks even though the story is marked as "done"? If so, measuring what you describe as cycle time would be inaccurate as it misses some of the working time.


author: George Stamos
body: Moving design sub-tasks to done would mean according to our policy for example that design phase is concluded meaning our story need to move to the next flow step. Same if blue ones move to done then another flow step will follow for the story etc.

To be honest I never mentioned I want to move the story to done. This will happen only if all sub-tasks are moved to done.

Hence there is metrics as you assume correct that Measure lead time as well from To do to done.

Nevertheless this is not what is this thread is about ?, thank you for asking


author: Bill Sheboy
body: Thanks, that helps! I misunderstood the language in your question to mean moving the story to "done", not just to transition it for the "in progress" steps.

In that case, [@Stefan Salzl](/t5/user/viewprofilepage/user-id/4616993) has you on a good track with using Lookup Issues with JQL and checking {{lookupIssues.size\|0}} to determine when all of the relevant subtasks have progressed to move the parent.


author: Sachin Dhamale
body: [@George Stamos](/t5/user/viewprofilepage/user-id/284103) ,

Can you try this automation rule

![automation transition.png](https://community.atlassian.com/t5/image/serverpage/image-id/188068i735BB9FF0EEBE40F/image-size/large?v=v2&px=999 "automation transition.png")

Accept the answer if it helps

comments: author: George Stamos
body: Hello [@Sachin Dhamale](/t5/user/viewprofilepage/user-id/785689) ,

Thank you for sharing!

Unfortunately this doesn't fall to the case I'm after.

It doesn't work for me

Best regards,

George


Tags: atl-gruland