How to use automation rules in Jira to delete attachments from old issues

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

Summary

The purpose of this article is to explain how to setup an automation to remove all attachments from work items that weren't updated during a time frame you set as a deadline in your projects.

Solution

Before you delete attachments

Deleted Attachments are gone forever

Note that once you remove the attachments, there is no backup file or anything you can do to retrieve them. They will be completely deleted.

Consider getting a copy of all attachments using export attachments via the REST API, and use a more restrictive JQL query initially.

Automation Rule Setup

  1. Access your Jira environment and go to Settings (⚙) > System > Global Automation.

  2. Choose Create rule to create the automation rule with the following options:

    1. As the Trigger, choose the Scheduled option.

      Trigger Schedule with the Basic and Advanced Option. The Basic option allows to specify frequency and time/day
    2. Choose the frequency and the time zone for the execution. See Trigger: Scheduled for more details

    3. Set the JQL query to filter all work items for which the attachments should be removed.

      For example, to select all work items that haven't changed in the last week, use

      attachments is not empty and updated < startOfDay("-7d")

      Adjust the query to fit your requirements.

  3. Choose the ACTION in this case, Delete Attachments. In the drop-down, select All attachments.

    Action Delete Attachments: For the filename drop down All attachments have been selected
  4. Select Turn on rule and give the rule a name to enable the rule.

✔️ Now it's done.

Executing the rule

Wait for the scheduled run time, and the attachments will be deleted based on the given JQL.

OR use the option Run Rule to run the rule immediately.

Updated on May 6, 2025

Still need help?

The Atlassian Community is here for you.