Automation for Jira: transition next sub-task

Patrick van der Rijst
Contributor
March 12, 2024

Here's a challenge for you.

Let's say you have a parent issue with X amount of sub-tasks. The order of the sub-tasks may vary.

 

When sub-task 1 is completed, you want to transition sub-task 2 to "ready".

Please note that, if you change the order of sub-tasks manually, the following conditional logic does not represent the order in which you have them configured.

{{#issue.subtasks{{index}}. {{key}}{{^last}},{{/}}{{/}}

I'd like to avoid creating custom fields for this. Using labels is fine, so mention in sub-task 1 via a label that sub-task 2 is next, etc.

2 answers

1 accepted

1 vote
Answer accepted
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 12, 2024

Hi @Patrick van der Rijst - The easiest way to manage this would be through issue linking.  For example Sub-Task 2 is blocked by Sub-Task 1 (you can create a custom link type if you have other use cases for the standard link types).  From there, you would use automation like this:

  • TRIGGER: Issue transition (To Done)
  • BRANCH: Linked Issues (Your Link Type)
    • ACTION: Transition Issue (To Ready)

If its the last issue in the chain, there would be no branch and the rule would simply exit.

NOTE - Make sure you are NOT using a link type without inbound/outbound designators (e.g. Relates To) as automation will have no way to detect what is the source/target for the rule.

Patrick van der Rijst
Contributor
March 13, 2024

Looks good :) Thanks!

Like # people like this
0 votes
Kalyan Sattaluri
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.
March 12, 2024

Hello @Patrick van der Rijst 

I was thinking, first get all sub-tasks which are not in completed state, then do a min on sub-task ID to get the next in line?

For example:

below gives sub-task IDs which are not "Done" state for example.

{{#subtasks}}{{#if(not(equals(fields.status.name,"Done")))}}{{id}}, {{/}}{{/}}

Then, we can store that in a variable {{myvar}},

make that into a list (by removing the last comma and splitting on comma),

and get the "MIN" of the result to get the ID of the next sub-task

and you can act upon it.

Sorry if this is not the requirement, please clarify.

Patrick van der Rijst
Contributor
March 13, 2024

the order of sub-taks could change, Automation does not reflect that, thanks for your effort though.

Like Kalyan Sattaluri likes this

Suggest an answer

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

Atlassian Community Events