Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation - Create Subtask based on Done status of all Subasts matching a specific Issue Type(s)

squal
Contributor
July 28, 2020

We are currently using several different Issue Types as Subtasks.  One of them is 'Development (sub)' and another is 'QA Testing' and there are others as well.  We are trying to configure an Automation rule which will create the 'QA Testing (sub)' subtask within the Parent Story when all 'Development (sub)' Subtasks and the 'QA Test Case (sub)' are in a Done status. 

I'm not a JQL expert and am struggling to get it to only trigger when all of the defined Issues Types are Done vs. just one.  Below is the beginning of what I have, but I could use the Communities expertise on how best to configure this.

 

Annotation 2020-07-28 175133.jpg

1 answer

1 accepted

1 vote
Answer accepted
JD
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 28, 2020

Hey @squal 

It looks like you're pretty close! This is how I would suggest setting up the rules:

(There are 2 suggestions for the JQL below)

Screen Shot 2020-07-29 at 2.00.34 pm.png

 

I'll just state my interpretation of what you want incase it's wrong :) 

When all development AND QA test case subtasks are done then create a QA testing subtask.

Some notes to consider:

  • This rule will run whenever a development or QA testing subtask is moved to done (or that's how I set it up with the condition after the trigger)
  • Move the "If issue type = story" above the "Related issue condition" because that can cancel the rule faster when it's a bug or other issue type.

For the related issue condition make sure you update the condition to "All match specified JQL". I'll explain 2 options for the JQL with varying scope:

First option: 

issuetype in ("Development", "QA test case") AND status = Done

This will only run if there are "Development" or "QA test case" subtasks attached to the parent. If any other type of subtask exists it will stop the automation here.

If you want it to run when other subtask exists just extend the JQL with an OR statement.

issuetype in (Development, "QA test case") AND status = Done OR issuetype in ("QA testing", sub-task)

You can see I added an "OR" and then defined the other subtasks that might exists but didn't define any status for the issues in the OR statement.

Also with JQL I'm absolutely not an expert but there is a quick visual way to get JQL. If you go to the top navigation click "Filters" and then "Advanced issue search" you are taken to the global issue navigator. 

You can use the drop downs to define what you want:

Screen Shot 2020-07-29 at 2.22.26 pm.png

Then click the "Switch to JQL" button on the right. This will switch what you have selected in the dropdowns the JQL. Just remember to click "Switch to basic" when you want to go back to the dropdown mode.

Screen Shot 2020-07-29 at 2.23.27 pm.png

It won't give you anything with an "OR" statement but its a good way to get the bits you need :)

Thanks,

John

squal
Contributor
July 29, 2020

Thanks so much @JD !  I'm still pretty new to automation and JQL and this was a huge help.  I restructured this as suggested and everything is working smoothly when it should.  However, it's also working when it shouldn't.  I ran a bunch of tests using different scenarios with different combinations of our subtask issue types and found that one type of scenario triggers it when it should not.

Problem Scenario

When parent Story has either of the following:

  1. "Development (sub)" Issue Type without "QA Test Case" Issue Type
    1.  - OR -
  2. "QA Test Case" Issue Type without "Development (sub)" Issue Type

Desired Scenario

 What I am trying to do is get it to only fire off if:

  1. Both "Development (sub)" Issue Type and "QA Test Case" Issue Type exist
  2. All instances of them are Done
  3. All other subtask Issue Types (if any) are ignored
  4. BONUS:  does not trigger if "QA Testing" Issue Type subtask already exists for Parent Story
    1. This is so that if it has already been triggered before, it won't trigger again

 

Below is what I have based on your feedback.  I've tried a number of changes to the JQL and even splitting it out into two separate 'And: Sub-tasks match' statements but can't seem to find a way to first determine that both exist in a Parent Story. 

I'm hoping you have another breakthrough tip for me!

 

Annotation 2020-07-29 172000.jpg

JD
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 29, 2020

@squal ok so with the problem scenario you can just add a few more "related issue conditions" after the one you have (the one with all the JQL).

So I added 2:

  • The first checks that some sub tasks match issueType = "QA test case"
  • The second checks that some sub tasks match issueType = "development"

You don't need to put status in because you already checked that previously. (Also note the different JQL the issue type uses an = instead of an in when you're checking for just one, I got caught on that).

For the bonus 🎉  just remove "QA testing" from the JQL in the related issue condition from last time so it would be something like this:

issueType in ("Development (sub)", "QA Test Case") AND status = Done OR issueType in ("AMS Email request, "Creative (sub)", "Sub-task")

This is because the original related issue condition checks that to "All subtasks match specified JQL", so if it sees any subtasks that you didn't write in the JQL it won't perform the action. (Also with that if you ever add a new subtask type to your project you'll need to update the rule).

Screen Shot 2020-07-30 at 8.37.08 am.png

 

Let me know how it goes!

Thanks,

John

squal
Contributor
July 30, 2020

@JD- Thanks again for the support.  Everything works like a charm now!  Better yet, your explanations have helped to make a bit more sense of the structures used in Automation (and JQL).  I was doing some of what you suggested, but used "IN" instead of "=" and in had some things in the wrong order.  Your breakdown was really helpful.  I really appreciate the quick responses and willingness to go into so much detail! 

Like JD likes this
thrilos07 March 4, 2021

So I tried your approach:

Subtask123.JPG

 

But it does not work for me. When creating those two Subtasks in the bottem you choose for Parrent Issue "Current Issue", right?

So I have this BPS-Issue. Which, whenever it is created, 4 new subtasks get created for this BPS-Issue. What I want is, that after those 4 issues all set to "Done" 2 new Issues get automatically created. This should work with this approach, or did I miss something?

squal
Contributor
April 12, 2021

Hi @thrilos07 - sorry for not noticing your question earlier.  Were you able to figure it out or is this still an open item for you?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events