Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,693
Community Members
 
Community Events
168
Community Groups

Automation to set status of subtask

Hi everyone,

I'm already using an automation rule that creates subtasks automatically. I now would like to add another automation that sets a specific status to each of the subtasks. So in the end, I want every automatically created subtask to start with a specific status.

Is there a way to create an automation rule like that? 

Kind regards,

Pauline 

2 answers

1 accepted

1 vote
Answer accepted
Mark Segall Community Leader Sep 09, 2022

Hi @Pauline Hild - You would need to Branch into each sub-task and then perform a Transition Issue action to transition to the desired status.

If you need additional help, please share a screen shot of your rule.

Hi @Mark Segall

thanks for your answer. Is it right like that? 

Bildschirmfoto 2022-09-10 um 10.34.21.png

Mark Segall Community Leader Sep 12, 2022

Hi @Pauline Hild - You'll want to move the create new sub-task above the branch.  It wouldn't hurt to add a re-fetch just before the branch as well.

Ok, I tried it out and it worked for one subtask but there must be problem with the rest because all subtasks got the same status as the first one and I don't know why. Do you see the mistake? 

Bildschirmfoto 2022-09-12 um 19.38.05.pngBildschirmfoto 2022-09-12 um 19.38.13.pngBildschirmfoto 2022-09-12 um 19.37.08.png

Mark Segall Community Leader Sep 12, 2022

So for each time you branch, you'll want to give specifics to ensure only those sub-tasks you want to transition actually transition.  You can accomplish this two ways:

  1. Change your branch to JQL
    1. parent = {{triggerIssue}} AND ...
  2. Add a condition under each of your branches (e.g. status = x or field value = y)

Ok, so when I want to add a condition under each branch, what do I have to set as status? In the example below it wouldn't make sense so set "sample qc" because this is the status I want the subtask to have after the automation rule worked.

 

Bildschirmfoto 2022-09-13 um 09.03.50.png

Mark Segall Community Leader Sep 13, 2022

Let's take a step back on this...  Are you wanting all newly created sub-tasks to immediately transition to SAMPLE QC?  If so, rather than having automation do this, why not create a workflow specifically for sub-tasks where the created transition (the one that comes off the circle) goes straight to SAMPLE QC?  This would be more efficient than having to always step through an unnecessary status.

If this is only for a specific use case (only sub-tasks generated off of the Task issue type), then you can continue down this path.  Your condition would be this:

  • status
    equals
    <Your first status> Looking at your list of statuses in the screenshot, I would assume this is PLANNING

No, every newly created sub-task should be immediately transitioned to a specific status but it's another status for every subtask. 

If I understood you right, I need to set the first status ("Planning") as the condition before each branch? 

Mark Segall Community Leader Sep 13, 2022

You'll need to have business logic to define what status you want each of these sub-tasks.  For example:

  • Something specific in the summary (summary ~ "keyword(s) you're looking for in the summary")
  • A component, label, custom field value
  • Some type of time parameter

Ultimately, you need to find a way to separate the specific sub-task from the pack so you're only transitioning sub-tasks that should be transitioned to the status you want them to be transitioned to.

Ok, so the logic behind this is that every subtask has in its summary the name of the status. In the screenshot down below it's for example "Sample QC" so I want the status to be "Sample QC" as well, immediately when the subtask is created. 

I couldn't find a way to integrate this for every subtask in my automation rule yet. In the moment, all other subtasks have "Sample QC" as well as their status.

 

Bildschirmfoto 2022-09-13 um 15.58.40.png

Mark Segall Community Leader Sep 14, 2022

So to be clear with the rule behavior:

  1. A single Task is created
  2. 1 sub-task is created
  3. That single sub-task is transitioned to another status
  4. A second sub-task is created
  5. That single sub-task is transitioned to another status
  6. Repeat

The important thing I'm getting at is that you're only creating a single sub-task at a time.  If I'm correct with my understanding, you just need to branch into the most recently created issue and transition it.  So your branch would be Most Recently Created Issue.

You are correct with your understanding.

I changed the branch into "most recently created Issue" but as the branch is placed before the "create subtask" action, it didn't work. 

Bildschirmfoto 2022-09-14 um 20.26.46.png

Mark Segall Community Leader Sep 14, 2022

The branch should be after the create sub-task.  You need the sub-task to be created then immediately after it's created you have it transition to the appropriate status.

You were right, I changed it and it finally works now.

Thank you very much for your efforts to help me!

Kind regards,

Pauline

Like Mark Segall likes this
1 vote
Darryl Lee Community Leader Sep 09, 2022

Hi @Pauline Hild - You can also do this by having a different rule that is triggered by the Subtask creation (with appropriate constraints, of course). The key is to check the Allow rule trigger box for your status-setting rule, as illustrated here: 

trigger.png

Credit to @Robin Flood for the image from this answer:

https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Can-I-use-automation-rule-to-trigger-another-automation-rule/qaq-p/912010

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events