Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,381
Community Members
 
Community Events
165
Community Groups

Deleted Filter in JIRA, how can I restore the filters?

Seem to have deleted filter by mistake and am now unable to see the related boards.

Please advise as to what to do?

I have the JIRA Admin access.

 

Thanks.

1 answer

0 votes

Create a new filter with the same name and definition, then edit each board to replace the deleted one.

Same problem, this does not work.

Jira Server does not show the board so it is not possible to edit it.

Is there a workaround to actually edit the board and replace the filter?

you have to go to the database to find the board or using scriptrunner.

 

This finds the boards with no filterID --- if you update fix = True it will delete them.  This code was taken off a search I did elsewhere.

def fix = false //if set to true this will delete the boards that have no filter associated

import com.atlassian.greenhopper.model.rapid.RapidView
import com.atlassian.greenhopper.manager.rapidview.RapidViewManager
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.issue.search.SearchRequestManager
import com.atlassian.jira.component.ComponentAccessor

public class NoCheck implements RapidViewManager.RapidViewPermissionCheck
{
public boolean check(RapidView view)
{
return true;
}
}
@WithPlugin("com.pyxis.greenhopper.jira")
@JiraAgileBean
RapidViewManager rapidViewManager
SearchRequestManager srm = ComponentAccessor.getComponent(SearchRequestManager)

def removed = []
rapidViewManager.getAll(new NoCheck()).value.each {b->
if(srm.getSearchRequestById(b.savedFilterId)==null) {
if(fix) {
def res = rapidViewManager.delete(b)
}
removed.add("${b.id} ,${b.name} ,${b.owner} || ")
}
}
def result = removed.join("\n")
return result

 

Then if you know the board (rapidviewID) and create a new filter then this script will update the board and allow you to see it.

 
import com.atlassian.greenhopper.manager.rapidview.RapidViewManager
import com.atlassian.greenhopper.model.rapid.RapidView
import com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser
import com.atlassian.jira.component.ComponentAccessor

long BOARD_ID = 296 //change to the rapidview id
long FILTER_Id = 79382 //new filter for that board

def rapidViewManager = PluginModuleCompilationCustomiser.getGreenHopperBean(RapidViewManager)
def rapidView = rapidViewManager.get(BOARD_ID).get()

rapidViewManager.update(new RapidView.RapidViewBuilder(rapidView).savedFilterId(FILTER_Id).build())

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,965 views 38 49
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