Automation to set status of subtask
Asked by Pauline Hild:

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


Answers:
author: Mark Segall
body: Hi [@Pauline Hild](/t5/user/viewprofilepage/user-id/4773022) - 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.

comments: author: Pauline Hild
body: Hi [@Mark Segall](/t5/user/viewprofilepage/user-id/4666637)

thanks for your answer. Is it right like that?

![Bildschirmfoto 2022-09-10 um 10.34.21.png](https://community.atlassian.com/t5/image/serverpage/image-id/215351i87BBAF84F66A6126/image-dimensions/369x765?v=v2 "Bildschirmfoto 2022-09-10 um 10.34.21.png")


author: Mark Segall
body: Hi [@Pauline Hild](/t5/user/viewprofilepage/user-id/4773022) - 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.


author: Pauline Hild
body: 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.png](https://community.atlassian.com/t5/image/serverpage/image-id/215559i22DCA71E5B746AC9/image-dimensions/248x529?v=v2 "Bildschirmfoto 2022-09-12 um 19.38.05.png")![Bildschirmfoto 2022-09-12 um 19.38.13.png](https://community.atlassian.com/t5/image/serverpage/image-id/215560i527A7B11F0F83ADC/image-dimensions/240x521?v=v2 "Bildschirmfoto 2022-09-12 um 19.38.13.png")![Bildschirmfoto 2022-09-12 um 19.37.08.png](https://community.atlassian.com/t5/image/serverpage/image-id/215561i0F48D014A60061B6/image-dimensions/453x185?v=v2 "Bildschirmfoto 2022-09-12 um 19.37.08.png")


author: Mark Segall
body: 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)


author: Pauline Hild
body: 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](https://community.atlassian.com/t5/image/serverpage/image-id/215662i393A27EF2127D1AD/image-size/large?v=v2&px=999 "Bildschirmfoto 2022-09-13 um 09.03.50.png")


author: Mark Segall
body: 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


author: Pauline Hild
body: 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?


author: Mark Segall
body: 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.


author: Pauline Hild
body: 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](https://community.atlassian.com/t5/image/serverpage/image-id/215740i17C16A833C8A40CA/image-size/large?v=v2&px=999 "Bildschirmfoto 2022-09-13 um 15.58.40.png")


author: Mark Segall
body: 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**.


author: Pauline Hild
body: 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](https://community.atlassian.com/t5/image/serverpage/image-id/216069iED12C4DF27894DF5/image-dimensions/459x228?v=v2 "Bildschirmfoto 2022-09-14 um 20.26.46.png")


author: Mark Segall
body: 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.


author: Pauline Hild
body: You were right, I changed it and it finally works now.

Thank you very much for your efforts to help me!

Kind regards,

Pauline


author: Darryl Lee
body: Hi [@Pauline Hild](/t5/user/viewprofilepage/user-id/4773022) - 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](https://community.atlassian.com/t5/image/serverpage/image-id/215336i738D969DF721E958/image-size/large?v=v2&px=999 "trigger.png")

Credit to [@Robin Flood](/t5/user/viewprofilepage/user-id/524201) 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>

comments: Pauline Hild