Transition the status of a subtask based on the transition of another subtask within the same Epic

Kane_Ansell December 11, 2022

Hi Everyone

I have an existing automation that creates a bunch of predefined Subtasks for an Epic when the automation is Manually Triggered, it creates about 11 in total.  The Summary given to each subtask takes the form of the Epic Summary followed by a specific summary for each Subtask, which takes the form of - Subtask Name.

For example, if the Epic Summary is Upgrade PC 1234, then the Subtasks will be automatically created as:

  • Upgrade PC 1234 - Backup Personal Data & Profile Info
  • Upgrade PC 1234 - Wipe Old Drive
  • Upgrade PC 1234 - Install new Image
  • Upgrade PC 1234 - Restore User Profile & Data
  • etc...

Essentially, it's a set of common tasks that need to be performed in a specific order for Epics of a particular nature.  Note: This is not actually for PC upgrading, but my use case would be confusing, so this is just an example I have provided).  This automation is all working as intended, it's the next bit that I need help with.

Here is where I need help
The Subtasks begin life all pre-assigned with a status of BACKLOG, except the first one, which has a status of IN PROGRESS.  As each Subtask is worked on and completed, they will be transitioned to CLOSED.  Once each subtask is transitioned to CLOSED I need the next one in the list to automatically Transition from BACKLOG to IN PROGRESS, until the last one, which when CLOSED should transition the Parent Epic to CLOSED (or maybe a pre-closure status - yet to be decided).

Other Info

 - I can restrict this to within a specific Project, it doesn't need to occur across multiple projects.

 - the subtasks are not 'linked' other than they all reside under the same parent epic

 - if it helps, as the subtasks are all created via automation at the same time, their numbering is sequential (ie CYSE-200, CYSE-201, CYSE-202 etc...

 - Ideally, I need to be able to do this without any Addons, as the company is not willing to invest in addons for this purpose (at least, not at this time)

- Preference would be for an automatic trigger, but worst case I could live with Manually Triggering at the closure of each Subtask if there is no automatic option for this.

Any help would be greatly appreciated.

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 11, 2022

Hi @Kane_Ansell 

First, let's try to clarify your scenario as that may help the community to offer suggestions...

Epics typically have child issues, of the types Story, Task, or Bug.  Are you actually adding Subtasks to Epics or do you mean something else?  For now, I will refer to them as "child issues".

Next, I am assuming that people are doing the work for these child issues.  If so, why would you automatically move them into "in progress", potentially before people are actually working on them?

Regardless of those questions, it seems your scenario is...

  1. something happens to an Epic, and that triggers a rule which adds child issues
  2. you want the child issues to be labeled in their Summary with the name (i.e. Summary) of the parent epic
  3. you want the child issues to be worked on in a specific order
  4. as a child issue completes as "closed", you want the next one in the specific order to move to "in progress"
  5. when the last child issue completes as "closed", you want the parent Epic to also complete as "closed"

Which parts of this scenario do you implemented in your rules thus far?  From your question, it seems like you have #1 and #2 done.

The only way I know of to enforce the specific order for #3, and so forth, is to have some field in the child issues which allows sorting them, such as with JQL with and ORDER BY clause.  If you do that, you can easily grab the next one which is not "closed" for processing, and when there are no more, move the Epic to "closed".

Kind regards,
Bill

Kane_Ansell December 11, 2022

Thanks Bill and thanks for your reply.

Let's set aside questions about why I want to automate the transitions to IN PROGRESS because that in itself is not relevant to the solution.

Yes, #1 & #2 are already done and working well.  And yes, I am using Subtasks as Child Issues of an EPIC, but I could just as easily change this to Tasks, on this particular board it doesn't make any difference unless you are suggesting related Tasks can be more easily identified using JQL than Subtasks?

Remember the tasks are sequentially numbered and have standard names appended to them such as (in my example) - Backup Personal Data & Profile Info or - Wipe Old Drive. 

Can you suggest some JQL that will find related tasks (or subtasks) that contains "- Wipe Old Drive" and change it's Status to IN PROGRESS?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2022

Without seeing your rule which is creating the "subtasks", there is no way to confirm that the issues are in fact in the order you expect consistently.  If we assume the issues are somehow are created in your sequence ordering...

For JQL, it could be this, used with the Lookup Issues action, and assuming the trigger issue is a "subtask":

parent = {{triggerIssue.parent}} AND issueType = Subtask AND statusCategory != Done ORDER BY Key

Then check if there are any remaining with an advanced compare condition to test if this value is greater than zero: {{lookupIssues.size|0}}

And if that passes, select the "next" issue to update with: {{lookupIssues.first.key}}

Kane_Ansell December 13, 2022

Hi Bill

I have been able to get the filter to work and i've setup the Adv Compare condition, but I feel i'm missing a step.  Maybe you've assumed I have more knowledge on this than I do, lol.  I'm relatively new to Automation and I have only very, very basic coding knowledge so i'm picking this up as I go along.

The Advance Compare is an IF statement, and the "Next" issue piece you mention would follow the IF statement, if the result is TRUE (greater than zero) but i don't see how to string the next piece together.  

This reports to have run successfully but doesn't actually change the Status of the next (or any) any Subtasks.  It reports No Issues Found Screenshot 2022-12-14 173611.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 14, 2022

You are very close to solving this...just a bit of adjustments to make the rule handle the two cases differently for siblings and parent...please note the nesting; that is how your  rule will appear in the editor.  You will need to add some if/else structure and branches.

  • trigger: manual, or some other trigger such as issue transitioned to Closed
  • condition: issueType is subtask
  • action: lookup issues as you have done
  • if/else condition:
    • advanced compare condition to check that {{lookupIssues.size|0}} is greater than 0
    • branch: on JQL to the next sibling subtask: key = {{lookupIssues.first.key}}
      • action: transition the subtask to "In Progress"
  • else (which means all of the sibling subtasks are done, and {{lookupIssues.size|0}} equals 0
    • branch on JQL to the parent with key = {{triggerIssue.parent.key}}
      • action: transition the parent to "Closed" or what you mentioned earlier... "pre-closure status - yet to be decided"

 

Please try that and let me know what you observe.  Thanks!

Suggest an answer

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

Atlassian Community Events