You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Trim Whitespace from Custom Field Names


Trim leading and trailing space from custom field names.


As a Jira admin, I want to fix custom field names that were created with a leading or trailing space. This is to avoid any potential issues when referring to a field with unknown whitespace. I can use this script to remove the leading or trailing whitespace from all of my custom fields, meaning I do not have to edit each affected field manually.

Good to Know


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.component.ComponentAccessor def customFieldManager = ComponentAccessor.customFieldManager customFieldManager.customFieldObjects.each { if ( != { log.warn("Modifying field with leading or trailing whitespace: '${}'") // Update the field - to preview only comment out the following line customFieldManager.updateCustomField(it.idAsLong,, it.description, it.customFieldSearcher) } }
Discovered an issue? Report it here

Suggested for you