Automate the transition of the workflow status when specific subtasks are marked as complete
Asked by Ishita Avinash:

Could you suggest a method for transitioning the workflow status in our Jira project to a specific state when only the IT and DevOps subtasks are marked as completed?

We have X number of subtasks categorized as IT and DevOps tasks, while the remaining subtasks may still be in the open state.


Answers:
author: Vikrant Yadav
body: Hi [@Ishita Avinash](/t5/user/viewprofilepage/user-id/4990422) Are you looking something similar? :

![Screenshot 2024-06-21 at 6.10.21?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/331119iB3B887EBAEE6FC59/image-size/large?v=v2&px=999 "Screenshot 2024-06-21 at 6.10.21?PM.png")

comments: author: Jovin
body: This is far more elegant than mine [@Vikrant Yadav](/t5/user/viewprofilepage/user-id/1801711) ! And uses less automation executions... I may need to update some of my own in my environment ?


author: Jovin
body: Hey [@Ishita Avinash](/t5/user/viewprofilepage/user-id/4990422)

This will require a bit of automation rule creation, let's go through it.

Some basics:

* All automation rules involved below must be able to be triggered by other rules, you can turn this flag on in the "Rule Details" section
* I assume you have a label called "IT" or "DevOps" for the purposes of this, if you use another field, simply change as required
* I assume the Subtask has a Parent
* I will assume the below workflows:
  * Subtasks: To Do \> In Progress \> Done
  * Stories: To Do \> Awaiting Tasks \<\> In Progress \> Done

Okay, assumptions out of the way - automation rule time!

**Rule 1: User closed IT or DevOps Subtask**

When a subtask has been closed, if the label "IT" or "DevOps" is present, this rule will log 0m work on the parent, triggering Rule 2.

* **TRIGGER: When: Issue transitioned**
  * From status: Leave blank (for from all statuses)
  * To status: Done
* **IF: Add a condition: Issue fields condition**
  * Field: Issue type
  * Condition: equals
  * Value: Subtask
* **IF: Add a condition: Issue fields condition**
  * Field: Labels
  * Condition: Contains any of
  * Values: IT, DevOps
* **FOR EACH: Add a branch: Branch rule / related issues**
  * Types of related issues: Parent
* **Add to branch: THEN: Add an action: Log work**
  * Time spent: 0m
  * Date started: {{now}}
  * Work description: {{triggerIssue.Summary}} has been closed.

**Rule 2: When IT or DevOps Subtask Closed, Check all Subtasks**

When work is logged on this ticket, find out if all IT or DevOps subtasks are complete, if they are, transition to In Progress.

* **TRIGGER: When: Work logged**
  * For: All worklog operations
* (Optional) **IF: Add a condition: Issue fields condition**
  * Field: Status
  * Condition: equals
  * Value: Awaiting Tasks
* **THEN: Add an action: Lookup issues**
  * JQL:  
    parent = {{issue.key}} AND labels IN (IT, DevOps) AND status != Done
* **IF: Add a condition: {{smart values}} condition**
  * First value: {{lookupIssues.size}}
  * Condition: equals
  * Second value: 0
* **THEN: Add an action: Transition issue**
  * Destination status: In Progress

Should be all good then!

comments: author: Ishita Avinash
body: Hi Team,

I apologize for my delayed response. I would appreciate your assistance with a couple of queries related to a project I'm working on. The project includes a rule that transitions the main issue status to "IT-Finance complete" when specific subtasks, with prefixes "IT" and "Fin," are marked as "Done." I have two questions:

1.**JQL Query and Transition Rule:** I need help reviewing my transition rule and JQL query. Could you please examine the screenshot I've attached and suggest any improvements? Specifically, I'm looking for advice on how to consolidate the five subtasks into a single JQL query.![test p.png](https://community.atlassian.com/t5/image/serverpage/image-id/339125i04B9E39422C868CF/image-size/large?v=v2&px=999 "test p.png")

2. **Duplicate Email Notifications:** We have another rule that sends an email notification when the status is changed to "IT-Finance setup complete." However, this rule is sending duplicate emails simultaneously. Can you help identify the cause of these duplicate emails and provide guidance on how to resolve this issue?

Thank you in advance for your help!![Screenshot 2024-07-31 174916.png](https://community.atlassian.com/t5/image/serverpage/image-id/339123i0C5FE86113083B9C/image-size/large?v=v2&px=999 "Screenshot 2024-07-31 174916.png")


Tags: cloud

jira-work-management-cloud