Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Housekeeping or continuous cleanup of the Agile activity artifacts

Hi awesome community! 


So automated housekeeping is good. If you want you can checkout (Cleanup-Jira-Part-1, Cleanup-Jira-2,)

Today, I would like to share use cases related to the cleanup Agile boards related stuff.

So to make the continuous cleanup I just use the groovy code, which is can be run on any app with support groovy like Scriptrunner, myGroovy, Grooviouli. 

Let’s start it.

Use case #1: Users are experimenting with Agile boards, own private boards, sometime you do migration. Then once your sprint reports shows incorrectly, where filters shows interesting things. Please, see below screenshot:

Action: Let’s remove Future Sprint data in Closed issues.


String jqlSearch = 'Sprint  in futureSprints() and status in (Closed, Done)  '

SearchService.ParseResult parseResult = searchService.parseQuery(loggedInUser, jqlSearch)
if (parseResult.isValid()) {
def searchResult =, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
def issues = searchResult.issues.collect { issueManager.getIssueObject( }

for (issue in issues) {
def customFieldsSprints = sprintField.getValue(issue)
log.debug customFieldsSprints
def newSprintValues = []
def changed = false
for (sprint in customFieldsSprints){
if (sprint.state == Sprint.State.FUTURE && !{
changed = true
if (newSprintValues.size == 0) { newSprintValues = null; changed = true; }

sb.append("Removing future sprint for ${issue.key} <br />\n")
if ( changed && !isPreview ){
sprintField.updateValue(null, issue, new ModifiedValue(null, newSprintValues), new DefaultIssueChangeHolder())
boolean wasIndexing = ImportUtils.isIndexIssues()
log.debug("Reindex issue ${issue.key}")

return sb.toString()

Full reference: in git

Conclusion: Time to time automated activities is efficient.


Use case #2: Once you do search using  JQL, like sprint = 12332, and total issues is 0. So You made reindexing, after you start to think, is this just some scrum master create Sprints and forgot to put issues. After investigation, you can find a lot of Sprints. As result, of that, most users are confused by searching by sprints. 

Action: Let’s remove unused sprints from our Jira instance.

sprintManager.getAllSprints().value.findAll {
}.findAll { Sprint sprint ->
def query = jqlQueryParser.parseQuery("sprint = $")
def hasNoIssues = !searchService.searchCount(user, query)
if (hasNoIssues) {
log.warn("Found sprint '${}' with no issues.")
sb.append("Found sprint '${}' with no issues.<br />\n")
}.each { Sprint sprint ->
if (!isPreview) {
sb.append("Removing sprint ${} <br />\n")
log.warn("Removing sprint ${}")

return sb.toString()

Full reference in git: 

Conclusion: Good to have copy/paste solution :)



Use case #3: Users are working frequently with filters, like add, edit, remove. (Of course, after that feature in our company filter stoped growing like exist situation Time to time, you can find unaccessible agile boards, which is lost long time ago a filters and users are already create a new one, because they just removed filters, instead of  remove first referenced agile board, dashboards and then filter.


Action: Let’s remove Agile boards without core filters.

sb.append("<b>Board id</b> - Name - <b> Owner </b><br />\n")
rapidViewManager.getAll(new NoCheck()).value.each { b ->
if (srm.getSearchRequestById(b.savedFilterId) == null) {
if (!isPreview) {
def res = rapidViewManager.delete(b)
sb.append("${} - ${} - ${b.owner}<br />\n")

return sb.toString()

Full reference in git 


I hope it helps for you. ( all info you checkout here

Have a good cleaning.



Gonchik Tsymzhitov


Max Malygin Community Leader Mar 24, 2020


It’s great to see the evolution of regular cleaning procedures for Jira.

Like Gonchik Tsymzhitov likes this

Hope it helps for you. 

Also, I will be if you provide some use cases of cleaning the Jira

Taranjeet Singh Community Leader Apr 02, 2020

Thanks, this is useful information!

Like Gonchik Tsymzhitov likes this

@Taranjeet Singh My pleasure!


Log in or Sign up to comment
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

809 views 24 28
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you