How to trigger creation of a subtask when all other custom subtasks are complete?

Charlotte Reynolds July 2, 2021

I am setting up a workflow in which an issue has a number of subtasks that need to be triggered in a certain order under the same status.

I have created three subtasks types e.g. A Subtask, B Subtask and C Subtask .

I have an automation rule that creates 2 A Subtasks and 1 C subtask. Once both of the A subtasks are complete, I would like it to trigger the creation of 1 B Subtask. The C subtask should not have any bearing on the creation of the B Subtask as it is a separate step.

It would be easy to do this with a status transition with conditions but unfortunately I need this to occur under the same status.

Does anyone have any ideas on how I would go about doing this?

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
JD
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 4, 2021

Hi @Charlotte Reynolds ,

This should be possible using a bit of JQL magic. You will need to add some identifier onto the two Subtasks A's. In the example below I added the label "required" only onto subtask A ,but you might have something else you would like to use.

Here's a screenshot of the second rule, I'll explain how it works below:

Screen Shot 2021-07-05 at 12.11.10 pm.png

 

  1. Issue transitioned trigger configured to only run on issues that are moved to done
  2. Issue fields condition to check if the unique identifier exists on the issue (again I chose to add the label "required" but you might choose something else)
  3. Issue field condition to check the issue type is a subtask. This just makes sure the rule doesn't fail because the next component reuqires the issue to be a subtask. 
  4. Branch/realted issue component with type of relationship set to parent. This branch allows us to look at the parent (rather than the sub task that triggered the rule).
  5. Related issue condition set related issues to "sub-tasls" and the condition to "All match specified JQL". This is where we use a bit of JQL magic. This condition will require all the sub-tasks for the parent to match the JQL you provide. This is what I put in (again my unqie identifer was labels so you will need to update yours accordingly):

    status = Done AND labels = required OR (labels != required OR labels is EMPTY)

    The condition itself rescricts the JQL to only show subtasks of the parent. So your search just needs to refine that a bit. The first half looks for sub-tasks with the status done and the lable required. The second half looks for sub-tasks without the reuqired label OR without any label. 

    In the case where 1 subtask A is done the rule won't trigger because the second Subtask A wouldn't match the JQL.
  6. Create subtasks

 

A little tip with the JQL, I usually go to the top nav and filters/advanced issue search. If you see a JQL input tap the "switch to basic" link on the right side. Then you can use the dropdowns to create your JQL search and "switch the JQL" to get the text string.

Hope that helps!

John

Charlotte Reynolds July 5, 2021

Thank you so much for this detailed answer! That JQL search tip is also going to be useful in many other situations. :)

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