Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
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 - https://botronsoftappfire.atlassian.net/wiki/spaces/CMJ/pages/51779994182773784/Quick+Fix.