Automation For Jira - Writing a rule that automatically closes issues that have been in the same status for X days

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This article explains how to configure an automation rule that will automatically close (or transition) issues that have been in the same status for at least X days.

One use case for which this rule can be useful is the case where you have a Service Management project where tickets have been waiting on the customer side for many days. For this type of ticket, you might want to either automatically transition the ticket to a "First reminder" status or close the ticket (depending on your workflow).

Solution

Automation Rule configuration

The rule can be configured as described below, but please feel free to adjust it (especially JQL query) so that it can fit your requirements:

  • Add a Scheduled trigger with the settings below:

    • Frequency: once per day

    • When rule executes: "

      run a JQL search and pass results to subsequent conditions and actions"

  • JQL query: The JQL query below will search for issues from the project SDBASIC that have been in the status "Waiting for customer" for at least 5 days (you might need to change the project name, status, and number of days)

1 project = SDBASIC AND status = "Waiting for customer" AND NOT status CHANGED AFTER -5d
  • Add the Transition Issue action

    • For this action, you can choose the transition or destination status of your choice (for example, Closed status, Resolved status, "First reminder" status...).

Automation Rule screenshot

The described above will look like this:

Screenshot of the rule

Updated on June 7, 2024

Still need help?

The Atlassian Community is here for you.