Forums

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

When a Subtask is Done → Subtask greater than 2 days old will be moved to Closed state

Shirley Setpally April 11, 2022

I created below rule [Custom] When a Subtask is Done → Subtask greater than 2 days old will be moved to Closed state. 48 hours duration is not being considered. As soon as the subtasks are done, they are moved to closed state w/o considering duration. 

Anything missing in my rule?

Capture.PNG

3 answers

0 votes
Jack Brickey
Community Champion
April 11, 2022

@Shirley Setpally , so what does the updated field actually display when the rule is run? Does it show <48h ago?

0 votes
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.
April 11, 2022

Hi @Shirley Setpally -- Welcome to the Atlassian Community!

Does this match your use case:

  • when a subtask moves from Code Review to Done
  • wait 48 hours, and then move it to Closed if it is not already there

If so, please consider changing your rule to periodically check for issues meeting this criteria using a Scheduled trigger and JQL, and then perform the last transition.  For example the JQL for the trigger could be:

project = myProjectName AND issueType = Subtask AND status CHANGED FROM "Code Review" TO "Done AND updated < -48h

Also please consider if issues could be updated for other reasons that would impact the 48h check you wanted.  If so, you could instead use statusCategoryChangedDate for your check:

project = myProjectName AND issueType = Subtask AND status CHANGED FROM "Code Review" TO "Done AND statusCategoryChangedDate < -48h

Kind regards,
Bill

Jack Brickey
Community Champion
April 11, 2022

Agree here that was my first thought but I have never actually played with the condition @Shirley Setpally  was illuminating and am interested in how it works. 

Like Bill Sheboy likes this
Shirley Setpally April 13, 2022

HI Bill, this did not work

I tried for querying just the done subtasks from issue tab, don't see any results

project = myProjectName AND issueType = Subtask AND status CHANGED FROM "Code Review" TO "Done 

 

Also how can i use this query to create a rule?

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.
April 13, 2022

Shirley, did you substitute in your own project name where I put the placeholder: myProjectName?

 

Once you have a query that works, you could create a rule with a Scheduled trigger running every 48 hours with that JQL, and then transition the issues as you noted earlier.

Shirley Setpally April 13, 2022

Yes i did update the projectname. No luck

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.
April 13, 2022

Hmmm...let's break this into pieces to see what is happening.

First try this query standalone in advanced issue search, to confirm there isn't some variation of another issue type name "subtask":

  • project = myProjectName AND issueType = Subtask

If that works, try to find any issues which transitioned from "Code Review" to "Done":

  • project = myProjectName AND status CHANGED FROM "Code Review" TO "Done" 

If none were returned that were subtasks, that is the issue.

If none were returned at all, then no issues made that transition from one status to another...or...those are not matching your status value names.

0 votes
Mark Segall
Community Champion
April 11, 2022

Hi @Shirley Setpally and welcome to the community!

Looking at your automation, it appears that when subtasks are moved to done and updated is after 48 hours it tries to move to done again.  

I'm assuming you want this to impact a different subtask.  In this case, you'd need a branch component.  Assuming you're looking for other subtasks sharing the same parent, you could do a branch based upon JQL like this:

parent = {{issue.parent}} and key != {{issue}}

 Then move those last two components under the new branch.

Suggest an answer

Log in or Sign up to answer