Example scripts
To homepage
Jira

Bulk Delete Custom Fields According to the Field Name
App in script

ScriptRunner For Jira
by Adaptavist
Compatibility

Jira (8.22 - 9.4)

ScriptRunner For Jira (7.7.0)
Language |
groovy
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.customFieldManager
def customFieldObjects = customFieldManager.customFieldObjects
/*
Specify the starting characters for the names of the custom fields that you intend to remove
For example, if the value is set to Test, then all the custom fields that begin with the name Test will be included
into the list and removed
*/
final def custom_field_name_starts_with = '<STARTING_CHARACTERS_IN_CUSTOM_FIELD_NAME>'
def filteredField = customFieldObjects.collect {
if (it.name.startsWith(custom_field_name_starts_with)) {
it.name
}
}.findResults { it } //This is to remove all null values from the List
filteredField.each {
def field = customFieldManager.getCustomFieldObjectsByName(it).first()
customFieldManager.removeCustomField(field)
}
Having an issue with this script?
Report it here