Forums

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

Create and test Jira automation rule for closing tasks

Sierra Lindamood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2025

I want to make it so that once all 8 linked tasks are closed, then for the primary linked ticket: The assignee is set back to the reported. The status is set to closed. It automatically adds a comment to the original ticket

These are automation rules that I tried to accomplish this, I know I'm off track here. Any commentary is appreciated. 

(Other issue types are the primary ticket, any linked item is a task issue type)

Screenshot 2025-09-16 120253.pngScreenshot 2025-09-16 120322.png

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2025

Hi @Sierra Lindamood -- Welcome to the Atlassian Community!

Would you please clarify your scenario?  Is it one of these:

  1. GIVEN a work item which has 8 other Tasks linked to it, WHEN all 8 Tasks are closed, THEN...
  2. GIVEN a work item with a linked Task, AND that linked Task has other linked Tasks in a chain of 8 work items, WHEN all Tasks in the chain are closed, THEN...
  3. something else

The first one can be solved using the Related Issues Condition, although I find that one a bit unpredictable in results / behavior.  Instead, try using the Lookup Work Items action with a JQL expression to find the linked Tasks for better control over the logic.

The second one cannot be easily solved with automation rules due to how branches work, although it is possible when there is a specific known number of linked work items.

 

Kind regards,
Bill

Sierra Lindamood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2025

Hi @Bill Sheboy 

It's 1.) GIVEN a work item, which has 8 other Tasks linked to it, and WHEN all 8 Tasks are closed THEN I need that work item to be auto closed, assignee set back to reporter, add my custom comment. 

Would my Lookup Work Items action with the JQL expression need to essentially say Any Issue Type that has Task Type Linked Items and ALL Linked Items are closed...THEN....

Sierra Lindamood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2025

Screenshot 2025-09-16 134400.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2025

Hi @Sierra Lindamood -- No, you could use the JQL needed to select only your specific ones.  For example:

  • action: lookup work items, with JQL of
project = yourProject
AND issue IN linkedIssues("{{triggerIssue.key}}")
AND issueType = Task
AND statusCategory != Done
  • smart values condition
    • first value: {{lookupIssues.size|0}}
    • condition: equals
    • second value: 0
  • ...continue to update the trigger work item

 

Please note the JQL inverts the condition to check for any not completed ones, and then tests that the count found is 0.

 

Like Sierra Lindamood likes this
Sierra Lindamood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2025

Screenshot 2025-09-16 140115.pngIs it to be expected that the JQL cannot be validated? When I put this jql in a regular search this part below, gives me this message: 

JQL error Issue '{{triggerIssue.key}}' could not be found in function 'linkedIssues'.
("{{triggerIssue.key}}")

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2025

Correct: when using smart values to create a dynamic JQL expression, that cannot be validated by the rule.

Instead, it is a good idea to test the JQL outside the rule with an example work item to confirm it works as expected.

 

And...With my suggestion, your rule would not use the branch as the lookup and condition take the place of that logic to test the linked work items:

  • trigger: your rule trigger
  • action: lookup work items...
  • smart values condition...
  • action: assign the work item
  • action: transition the work item
  • action: add the comment

 

Like Sierra Lindamood likes this
Sierra Lindamood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2025

To test on just one work item, let's say the key is LOCAL-4571, what would you say is the best way to test this rule for just against that one? 1. Make sure all of the Tasks are Closed and the main ticket Opened, then ? Screenshot 2025-09-16 151248.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2025

To test, you could change the Scheduled Trigger's JQL to only return one work item with:

key = LOCAL-4571

 

And, please re-read what I posted as the rule would use a Lookup Work Items action in order to use the {{lookupIssues}} smart value.  It would not use the JQL condition as you show.

Like Sierra Lindamood likes this
Sierra Lindamood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2025

Thank you very much, learned a lot here and had success. @Bill Sheboy 

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2025

Awesome; I am glad to learn that helped!

0 votes
Corinne Guibert
Contributor
September 16, 2025

I'm 

When do you want the rules to be executed :  when the last subtask is closed ? Or doing a hourly check is enough ?

 

your first automation runs when there is a transition to Open or Reopen. It should be Done (or whatever closing status your are using)

What is your selection criteria on the scheduled automation ?

Sierra Lindamood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2025

What needs to happen is when the last linked item is closed, that then closes the primary ticket that all of the linked items are connected by. 

The scheduled aspect was a way I thought I may have to do it, to have the system check that all the linked items are closed to then trigger the rest of what needs accomplished. 

Sierra Lindamood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2025

Screenshot 2025-09-16 134400.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
TAGS
AUG Leaders

Atlassian Community Events