Maximum Change History Records Per Issue
Use this built-in script to find issues with change items that exceed the recommended amount, and delete the oldest. Change groups left empty through the deletion of change items are also deleted. View the Atlassian documentation on the recommended number of change items and change groups. An issue is automatically re-indexed if any of its change items or groups are deleted.
Reporting
This built-in script returns all issues that contain change items over the specified maximum limit. Atlassian recommends a maximum of 20,000 change items or change groups, but you can set your own maximum value. For every change item, or set of change items, there is also a change group. We have set a default number of 10,000 change items which takes into account change groups. Change groups left empty through the deletion of change items are also deleted.
You can use the Change item filter to search for change items that fit the criteria of a script. For example, you can search for changes made by named users, or you can search for changes to a priority field. Select Show snippets to see, and edit, example scripts that you can use to filter change items.
Deleting change items and change groups
Change items and groups are permanently deleted. You cannot retrieve deleted change items and groups without restoring from a backup.
If this built-in script finds issues with a change item amount that exceeds the threshold, you are provided with the option to delete the oldest. You can use the Change item filter, as described above, if you wish to further filter issues or change items by a set criteria.
Running this built-in script
- From ScriptRunner, navigate to Built-in Scripts → Guardrails: Maximum change history records per issue.
- Enter a value under Max number of change items, or leave at the default of 10000.
- Select the project(s) you wish to search, or leave the Project field blank to search all projects.
- Enter a script into the Change item filter script console, if you wish to further filter change items.
- Select Preview to display the number of issues that fulfill the criteria you have set.
Select Permanently delete X change item(s) if you wish to delete the selected change item(s). Change groups left empty through the deletion of change items are also deleted.
Change items and groups are permanently deleted. You cannot retrieve deleted change items and groups without restoring from a backup.
Issues are automatically re-indexed if any of its change items or groups are deleted.
Tips
Test on your non-production instance first
Be sure to test on a copy of your production instance first. This is a destructive operation, there is no "undo" button.
Want to delete all change items that fulfil a filter?
If you wish to delete all change items that fulfil the filter, regardless of whether they are over the threshold, just reduce the threshold number to zero.
Revisit this cleanup activity
You may wish to revisit this cleanup activity, for example on a quarterly basis.