Restrict the administration of custom fields

WARNING: This setting does not affect configuration changes made at the API level. It only determines the visibility/access of configuration options within the Jira administration interface.

The following script allows you to to restrict the administration of custom fields. The following three access levels are available:

  • LOCK No user can edit the field's configuration.
  • SYSTEM_ADMIN_LVL Only system administrators can edit the field's configuration.
  • ADMIN_LVL System administrators or administrators can edit the field's configuration.


Jira Jira (7.7 - 7.13)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.managedconfiguration.ManagedConfigurationItemBuilder
import com.atlassian.jira.config.managedconfiguration.ManagedConfigurationItemService

import static com.atlassian.jira.config.managedconfiguration.ConfigurationItemAccessLevel.*

// the name of the custom field
final String customFieldName = "TextFieldA"

def customField = ComponentAccessor.customFieldManager.customFieldObjects.findByName(customFieldName)
assert customField: "Could not find custom field with name $customFieldName"

def managedConfigurationItemService = ComponentAccessor.getComponent(ManagedConfigurationItemService)
def field = managedConfigurationItemService.getManagedCustomField(customField)

def managedField = ManagedConfigurationItemBuilder

def outcome = managedConfigurationItemService.updateManagedConfigurationItem(managedField)
assert outcome.valid: outcome.errorCollection

Discovered an issue? Report it here

Suggested for you