...
Code Block | ||
---|---|---|
| ||
def fix = false import com.atlassian.greenhopper.model.rapid.RapidView import com.atlassian.greenhopper.manager.rapidview.RapidViewManager import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean 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; } } @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 |
For the latest version of the script runner app (i.e 6.14.0), use the below code:
Code Block |
---|
def fix = false
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 |
Resolution 3:
To delete the affected board the integrity check violation offers a quick fix. More about quick fixes in integrity check could be found here.