Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to automatically create a sub-task when other two sub-tasks are DONE under the same parent.

Caleb Park
Contributor
April 26, 2023

Hi guys,

 

My workflow system is like the following:

1. When a Story is created, two sub-tasks are automatically created under that Story.

2. When BOTH of those two sub-tasks are marked as DONE, another new sub-task should be automatically created under the same Story.

 

Here, the most important point is:

Both of two sub-tasks MUST be DONE to get the next new sub-task. If only one of those two sub-tasks is done, new sub-task should not be created.

 

Thank you so much!

1 answer

2 votes
Heather Ronnebeck
Community Champion
April 26, 2023

You can do this with Jira's Automation feature in the project if you have project admin. The automation rule would be triggered upon transition of a ticket. 

I'm not sure the exact configuration, but basically you'll need to trigger it when sub-tasks close, and have it look in the parent ticket (I think with branches and if statements) to ensure that there are no open sub-tasks. If there are no open sub-tasks, then create sub-task 3. If there are open sub-tasks, do nothing. 

That's the jest of how the rule would work. The actual implementation on it, I'd need to spend more time to give you the exact config. 

This guide here should also help. https://support.atlassian.com/cloud-automation/docs/jira-cloud-automation/

Caleb Park
Contributor
April 27, 2023

Can you provide me more details about your method with something like snapshots of automation?

Heather Ronnebeck
Community Champion
April 27, 2023

I can't do snapshots, but maybe this will help better:

Automation rule #1: Creating two sub-tasks when a story ticket is created

  1. Go to your Jira project and click on the "Settings" gear icon in the bottom left corner of the screen.
  2. Select "Automation" from the menu on the left-hand side of the screen.
  3. Click the "Create rule" button.
  4. Give your rule a name, such as "Create two sub-tasks when a Story is created."
  5. Under the "If" section, select "Issue created" from the "When" dropdown menu, and select "Story" from the "Issue type" dropdown menu.
  6. Under the "Then" section, click "Add action."
  7. Select "Create issue" from the list of available actions.
  8. Give your first sub-task a name and select "Sub-task" as the issue type.
  9. Under the "Project" dropdown, select your current project.
  10. Under the "Parent issue" dropdown, select "Current issue" to link the new sub-task to the current Story.
  11. Under the "Fields" section, set the appropriate fields for the new sub-task (e.g. assignee, due date, description, etc.).
  12. Click "Save" to save your new rule.
  13. Repeat steps 7-12 to create the second sub-task.

Now, whenever a Story is created, two sub-tasks will automatically be created under that Story.

Automation rule #2: Create third sub-task when two sub-tasks are completed

  1. Go to your Jira project and click on the "Settings" gear icon in the bottom left corner of the screen.
  2. Select "Automation" from the menu on the left-hand side of the screen.
  3. Click the "Create rule" button.
  4. Give your rule a name, such as "Create third sub-task when two sub-tasks are completed."
  5. Under the "If" section, select "Issue transitioned" from the "When" dropdown menu, and select "Sub-task" from the "Issue type" dropdown menu.
  6. Click "Add condition" and select "Compare condition."
  7. In the first dropdown, select "Number of linked issues" and set it to "equals" and "2."
  8. In the second dropdown, select "Number of linked issues with specified JQL" and enter the following JQL query: "status = Done"
  9. Under the "Then" section, click "Add action."
  10. Select "Create issue" from the list of available actions.
  11. Give your new sub-task a name and select "Sub-task" as the issue type.
  12. Under the "Project" dropdown, select your current project.
  13. Under the "Parent issue" dropdown, select "triggerIssue.parent" to link the new sub-task to the current Story.
  14. Under the "Fields" section, set the appropriate fields for the new sub-task (e.g. assignee, due date, description, etc.).
  15. Click "Save" to save your new rule.

Now, whenever two sub-tasks are marked as "Done" under a Story, a third sub-task will automatically be created under the same Story.

Like Morgan Watts likes this
Caleb Park
Contributor
April 28, 2023

Thank you for all the details? Heather!

 

Since I know how to the Automation rule #1, let’s focus on rule #2.

For step 6 and 7 above, you mentioned “Compare Condition”. But according to my JIRA automation components, there is no “Compare Condition”. There is “Advanced Compare Condition” instead, but when I click on it, the first value does not have any “Dropdown”, only JQL version typing system.

I am not sure if we are using the same system, but anyways, is there a way to make it work using “Advanced Compare Condition”? Or is there a way to find “Compare Condition” that you mentioned?

Heather Ronnebeck
Community Champion
April 28, 2023

My apologies @Caleb Park I meant to select the "Related Issues Condition"

Screenshot 2023-04-28 at 8.18.49 AM.png

Caleb Park
Contributor
April 29, 2023

Hi Heather,

 

Now I have another question. So, according to your automation steps, where is step for fields of those two subtasks?

when those two subtasks get created after a Story is created, those two have different specific Labels, and those need to be called into the automation.

Heather Ronnebeck
Community Champion
April 29, 2023

Hi @Caleb Park 

You can always add in a step 16 or more for editing the newly created issue and making the edits needed to have the specific labels. 

Caleb Park
Contributor
April 30, 2023

Hi Heather,

 

I actually meant specific Labels for those TWO subtasks that need to be done together, not newly created issue.

For example, your step 5 mentions about “Issue Transitioned”, so I understand I can make it like: “When” something is done.

But step 7 just says that “Number of linked issues” is equal to “2”. Where do I put information about those “two” subtasks? For instance, those two subtasks have specific Labels. And I think the specific Labels should be called for “Number of linked issues” stuff.

Heather Ronnebeck
Community Champion
May 1, 2023

In the screenshot I shared, you can always call out additional requirements by adding more conditions. So you can add in the fact that labels have to equal certain terms. 

Caleb Park
Contributor
May 1, 2023

Hi Heather,

 

Thank you for your help, but another question is:

In related Issues Condition, Condition only has 4 options like the following:

1.png

 

There is no "Are Greater Than" under Condition dropdown option. Is there any way to make that option?

Suggest an answer

Log in or Sign up to answer