Transition status of a Story when all sibling Tasks and Bugs are completed.
Asked by Keir McGuffog:

We have a project set up with a number of epics, each consisting of a story and multiple tasks. We want to transition the status of the story from AWAITING DEV to READY FOR QA when all of the sibling tasks (or bugs) in the epic have a status of READY TO DEPLOY, DONE, or OBSOLETE (or a status category of *Done*). Thanks in advance for any help.


Answers:
author: Keir McGuffog
body: Again, posted by mistake.


author: Keir McGuffog
body: Posted by mistake.


author: Mark Segall
body: Hi [@Keir McGuffog](/t5/user/viewprofilepage/user-id/410953)

So you're saying that each Epic will only have one story and a bunch of related Bugs/Tasks? If so, you could do something like this:

* TRIGGER: Issue Transitioned (To Ready to deploy, Done, Obsolete)
* ACTION: Lookup Issues  
  * issueType != Story AND "Epic Link" = {{issue.Epic Link}} AND status NOT IN ("Ready to Deploy", Done, Obsolete)
* CONDITION (Advanced)
  * {{lookupIssues.size}}  
    Less Than  
    1
* CONDITION: Status not equal to Ready for QA
* ACTION: Transition Issue (to READY FOR QA)

comments: author: Keir McGuffog
body: Hi, and thanks for the response. I've tried the config above but have had it come back as failing. I'm guessing that this is due to the Story workflow being different to Tasks and Bugs?  

To answer your question, yes, each Epic will have one story and a bunch of related Bugs and Tasks.

Here's the Task/Bug workflow...  
![Screenshot 2023-08-21 150637.png](https://community.atlassian.com/t5/image/serverpage/image-id/276222i29C47D2FEF162712/image-size/large?v=v2&px=999 "Screenshot 2023-08-21 150637.png")

...the Story workflow...

![Screenshot 2023-08-21 150739.png](https://community.atlassian.com/t5/image/serverpage/image-id/276223i3FA10AF55FA45D39/image-size/large?v=v2&px=999 "Screenshot 2023-08-21 150739.png")

...and the audit log.  

![Screenshot 2023-08-21 150906.png](https://community.atlassian.com/t5/image/serverpage/image-id/276227i4846C7BF63B30535/image-size/large?v=v2&px=999 "Screenshot 2023-08-21 150906.png")


author: Mark Segall
body: It looks like you'll need to add a condition before the lookup issues action

Issue Type = Story


author: Keir McGuffog
body: No, I'm afraid it's still not behaving as hoped.  

These are the issues I'm using to test...  

![Screenshot 2023-08-21 162709.png](https://community.atlassian.com/t5/image/serverpage/image-id/276253iD6359D890247CE26/image-size/large?v=v2&px=999 "Screenshot 2023-08-21 162709.png")  

...and this is the audit log.  

![Screenshot 2023-08-21 162730.png](https://community.atlassian.com/t5/image/serverpage/image-id/276252i2965669BEB7BE151/image-size/large?v=v2&px=999 "Screenshot 2023-08-21 162730.png")


author: Mark Segall
body: Sorry - Let me take this a step back because we may have gone off path a bit.

You want when all bugs/tasks transitioned to Obsolete, Ready To Deploy or Done that the Story should be transitioned to Ready for QA. The rule needs to be tweaked (this is on me)

* TRIGGER: Issue Transitioned (Obsolete, Ready to Deploy, Done)
* CONDITION: Issue Type NOT EQUAL Story
* ACTION: Lookup Issues
  *

    ```
    issueType != Story AND "Epic Link" = {{issue.Epic Link}} AND status NOT IN ("Ready to Deploy", Done, Obsolete)
    ```

* CONDITION: Advanced
  * CONDITION (Advanced)
    * {{lookupIssues.size}}  
      Less Than  
      1
* BRANCH (JQL)
  *

    ```
    issueType = Story AND?AND "Epic Link" = {{issue.Epic Link}} AND status != "Ready for QA"
    ```

  * ACTION: Transition Issue (to READY FOR QA)


author: Keir McGuffog
body: Yes, to confirm, when all bugs and tasks are transitioned to Obsolete, Ready to Deploy or Done, the Story within the parent Epic should be transitioned to Ready for QA. Unfortunately, those tweaks are still missing something.  

Here's the audit log again...  

![Screenshot 2023-08-21 170256.png](https://community.atlassian.com/t5/image/serverpage/image-id/276266i8AC283DB93AD0A89/image-size/large?v=v2&px=999 "Screenshot 2023-08-21 170256.png")

NB I tweaked the BRANCH JQL rule as there seemed to be an extra AND, which was causing an error, and it makes sense for the story to only be transitioned if it originally has a status of "Awaiting dev".