Automation with specific selection of subtasks summary
Asked by Ribeiro Perovano_ Patrick _KWLIB_:

First let me try to explain the concept:  

In a specific status on workflow, 5 sub-task will be created on my task. e.g.:

Workflow status: **Load In Progress**.

Then create 5 subtasks with the same issue type but different names:

Upon reaching this status, 5 subtasks will be created with the same issue type, but with different summary:

* Subtask Load (To do)
* Subtask Model 1 (To do)
* Subtask Model 2 (To do)
* Subtask Model 3 (To do)
* Subtask Model 4 (To do)

After subtasks 1, 2, 3 and 4 are "Completed", and the Load subtask is "in progress" or "to do", 5 new subtasks must be created (with the same issue type), but with different names. So, the scenario will be:

* Subtask Load (In Progress)
* Subtask Model 1 (Completed)
* Subtask Model 2 (Completed)
* Subtask Model 3 (Completed)
* Subtask Model 4 (Completed)
* Subtask Sync 1 (To do)
* Subtask Sync 2 (To do)
* Subtask Sync 3 (To do)
* Subtask Sync 4 (To do)

When I try to do this automation, I get stuck checking by parent and name/status of subtasks. For example:

When issue transition from "In Progress" to "Completed"  
AND  
Issue type = Issue_type_Subtask  

for Parent  
Related Issue Condition = Subtasks  
AND  
Condition: All Match specified JQL  
Status (Completed)  
AND Summary begin with "Subtask Model "  
THEN Create new subtask Sync

From what I understand, this check looks at all subtasks (summary and status) and not some specific group of subtasks. As I have one subtask with a different name (Subtask Load), nothing will happen with this automation.  

Is there any way to, for example, search for all the subtasks that are presented in my task, get **ONLY** the subtasks that begin with the summary "**Subtask Mode** l", from that selection check their status if they are "**Completed** " and then create the new subtask "**Synchronization Subtask**"?


Answers:
author: Trudy Claspill
body: Hello [@Ribeiro Perovano_ Patrick _KWLIB_](/t5/user/viewprofilepage/user-id/5473233)

You might want to try a rule like this

![Screenshot 2024-07-18 at 2.45.51?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/336525i0B1C5F16CC46A72E/image-size/large?v=v2&px=999 "Screenshot 2024-07-18 at 2.45.51?PM.png")

I changed the trigger to specifying just the destination statuses that you're looking for; Done (or Completed) for the Model subtasks and "In Progress" for the Load subtask. I did this to account for the scenario where maybe Load got changed to In Progress before the last of the Model subtasks was changed to Complete.

Then there is a condition to confirm that the transition occurred on a subtask type issue.

Then there is a another condition to check the Summary of the triggering subtask, to make sure it was a Load or Model subtask.

Then start a branch to change focus to the Parent of the triggering subtask.

![Screenshot 2024-07-18 at 2.48.57?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/336526i354FE885147BE420/image-size/large?v=v2&px=999 "Screenshot 2024-07-18 at 2.48.57?PM.png")

The first condition checks that there are no "Model" subtasks that are not Complete.

The second condition ensures that the Load subtask in In Progress.

The third condition ensures that the Sync subtasks were not already created (in case the statuses on the Load or Model subtasks recycled and the Sync subtasks were created previously).

If all three conditions are met, then create the Sync subtasks.


Tags: automation

cloud

jira-service-management

jql

subtask