Structure (DC)

Find Saved Views Containing Notes Columns

This script finds saved views that contain a Notes column. Go to the Logs tab after running this script to see the names of each view found by this script.

Groovy
import com.almworks.jira.structure.api.StructureComponents
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import com.onresolve.scriptrunner.runner.customisers.WithPlugin

@Grab(group = 'com.almworks.jira.structure', module = 'structure-api', version = '*')
@WithPlugin('com.almworks.jira.structure')

StructureComponents components =
ScriptRunnerImpl.getPluginComponent(StructureComponents)

def matchingViews = components.viewManager.getViews(null).findAll { view ->
view.specification.columns.any { column -> column.key == 'notes' }
}

matchingViews.each { view ->
log.warn("View: ${view.name} | DC view ID: ${view.id}")
}

return "Found ${matchingViews.size()} saved views with Notes columns."