Issue Archiving Job (Data Center)
The Issue Archiving Job is only available on Data Center 8.1 and above.
Automate the archiving of issues with a ScriptRunner Issue Archiving Job. Periodically archive issues based on a JQL query. For example, you want to archive any closed issues that have not been updated in over two years. This will improve performance and reduce the risk of users viewing Jira issues that are no longer relevant.
After archiving, issues cannot be found by searching and become read-only.
From ScriptRunner, navigate to the Jobs tab and click Create Job > Issue Archiving Job.
Enter a Name, for example, Archive old issues.
Under User, enter the user the job will run as.
Create a user called Automation (or similar) and give it administrator rights in every project. Then set Automation as the User when setting up an issue archiving job.
In the Interval/Cron expression field, enter how often the job should run. The interval can be in minutes, entered as an integer, or a cron expression. The example below runs on the first Monday of every month.
Jobs set to run at intervals run automatically upon start-up of Jira. To avoid this, use non-interval cron expressions specifying the time the job should run (as seen in the example above).
For more information on cron expressions, see Constructing Cron Expressions for a Filter Subscription.
In JQL Query, enter a query to select the issues you wish to archive. For example, issues in a specific project that have the status Closed and have not been updated for over two years.
Test the query in the Issue Navigator first. The query runs as the configured user, and therefore, due to permissions, may see different results from the current user. For more information on JQL queries, see Advanced Searching.
Click Add to save the job; the script will run on the interval specified. Optionally, click Run now to run the script and view which issues were affected.
Clicking Run now does not save the job. Click Add to save.
See the Atlassian documentation for details on how to restore issues.