Subtasks update parent task
Asked by Abi Williams:

Hello all,

I wish to update the parent's task status based on the sub-task. At the moment I have basically tried a few things that don't work.

Has anyone got any automation for this?

We are on a team-managed project. We don't need this outside of this project.


Answers:
author: Anandhi Arumugam
body: Hi [@Abi Williams](/t5/user/viewprofilepage/user-id/5492988) Please try something like the one below. If you need specific help, please elaborate your use case.  

![Automation - Update Parent.png](https://community.atlassian.com/t5/image/serverpage/image-id/339171i309AEB363AAD1709/image-dimensions/281x261?v=v2 "Automation - Update Parent.png")

comments: author: Abi Williams
body: Hello [@Anandhi Arumugam](/t5/user/viewprofilepage/user-id/5552450)

Below is an image.

In this case, i have two sub-tasks that are currently in peer review. I need the parent task to be updated to whatever the latest subtask is. Probably need to be any status other than done.

![Screenshot 2024-07-31 162639.png](https://community.atlassian.com/t5/image/serverpage/image-id/339175iA031538578C6033A/image-size/large?v=v2&px=999 "Screenshot 2024-07-31 162639.png")


author: Anandhi Arumugam
body: Hi [@Abi Williams](/t5/user/viewprofilepage/user-id/5492988) How do you define the latest subtask? Is it the status or recent status change?


author: Abi Williams
body: Recent status change. So if it changes from Peer Review to QA the latest status would be QA even if one ticket is still In Progress.


author: Trudy Claspill
body: Hello [@Abi Williams](/t5/user/viewprofilepage/user-id/5492988)

My suggestion is that you use two rules.

In rule number #1 have the trigger be an Issue Transition, and for Destination Statuses select all the statuses except Done. Add a Issue Fields condition to check that the Issue Type is subtask. If it is then use a For: Related Issues: Parent branch to navigate to the Parent issue and add a Label value to it to indicate its Status needs to be update; something like "Recalculate-Status".

In rule #2 use a Field Value Updated trigger, and look for the addition of a value to the Labels field. Add an Issue Fields condition to check that the Issue Type is one of the types that can have a subtask as a child. Add another Issue Fields condition to check that the Labels field has the value you specified in the first rule; i.e. "Recalculate-Status". Add an Edit Issue action to remove that label value - it was needed only to trigger this rule, and might be needed again in the future. Then use an If-Else condition to evaluate the Statuses of the child subtasks, similar to this:

![Screenshot 2024-07-31 at 12.57.03?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339233i09F0B892942EDAEE/image-size/large?v=v2&px=999 "Screenshot 2024-07-31 at 12.57.03?PM.png")![Screenshot 2024-07-31 at 12.58.27?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339234i98B240F37E080F8D/image-size/large?v=v2&px=999 "Screenshot 2024-07-31 at 12.58.27?PM.png")

The sequence of the If-Else blocks should be checking for the Statuses in order from **right (latest) to left (earliest).**

comments: author: Abi Williams
body: Hello [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011)

Do you have an example of the first one please? I think i roughly know what you are asking for but wouldnt mind it being confirmed.

Cheers.


author: Trudy Claspill
body: ![Screenshot 2024-08-01 at 7.50.58?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/339468iAE3BDE77B05943C3/image-size/large?v=v2&px=999 "Screenshot 2024-08-01 at 7.50.58?AM.png")


author: Abi Williams
body: Hey [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011)

I am trying the second part of your query but i cannot find the generate label?

![Screenshot 2024-08-05 154801.png](https://community.atlassian.com/t5/image/serverpage/image-id/340019i42121D8D0BF0C610/image-size/large?v=v2&px=999 "Screenshot 2024-08-05 154801.png")


author: Trudy Claspill
body: Add the label value to an existing issue. Then create this condition in your rule. Then you can delete the value from the existing issue.

Otherwise you would need need to use a smart value condition in order to create the Condition when the label value does not currently exist in any issue.

![Screenshot 2024-08-05 at 8.59.25?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/340050iC84E139C936B2C48/image-size/large?v=v2&px=999 "Screenshot 2024-08-05 at 8.59.25?AM.png")


author: Abi Williams
body: Hello [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011)

I can confirm which label field you are using? I appear to get an errors on mine. I use the Labels (System) which appears to work but when trying to search for it on the rule 2 it doesnt appear to find it. If i change to Labels (labels) i appear to get errors. Not entirely sure what to do.

![Screenshot 2024-08-06 174501.png](https://community.atlassian.com/t5/image/serverpage/image-id/340312i6DFF34CB5FCCE0C5/image-size/large?v=v2&px=999 "Screenshot 2024-08-06 174501.png")


author: Trudy Claspill
body: In my environment the field in a Team Managed project is called simply Labels.

![Screenshot 2024-08-06 at 10.05.51?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/340315i2A52E525ED169321/image-size/large?v=v2&px=999 "Screenshot 2024-08-06 at 10.05.51?AM.png")

Jira allows the creation of custom fields with names identical to field names used for other fields. It appears that you have more than one field in your instance named "Labels".

Please show us the rules that you have created showing the details of the steps where you are trying to interact with the Labels field. Also show us the Audit Log output for an execution of the rule when it is configured in that manner.