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 Option Values


Trim leading and trailing space from custom field option values.


As a Jira admin, I want to fix custom field options that were created with a leading or trailing space. This is to avoid any potential issues when referring to a field option with unknown whitespace. I can use this script to remove the leading or trailing whitespace from all of my custom field options, meaning I do not have to edit each affected option 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 optionsManager = ComponentAccessor.optionsManager optionsManager.allOptions.findAll { it.value != it.value.trim() }.each { optionsManager.setValue(it, it.value.trim()) }
Discovered an issue? Report it here

Suggested for you