Skip to content

Instantly share code, notes, and snippets.

@jechlin
Created January 25, 2017 08:54
Show Gist options
  • Save jechlin/d66bfd81334956633b99aed8ae899f91 to your computer and use it in GitHub Desktop.
Save jechlin/d66bfd81334956633b99aed8ae899f91 to your computer and use it in GitHub Desktop.
package examples
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.metadata.JiraMetadataDSL
import groovy.transform.BaseScript
def customFieldManager = ComponentAccessor.getCustomFieldManager()
@BaseScript JiraMetadataDSL delegate
customfields([
[
"name" : 'mould.Xxxxxx',
"description" : 'description',
"type" : "com.atlassian.jira.plugin.system.customfieldtypes:textfield",
"searcher" : "com.atlassian.jira.plugin.system.customfieldtypes:textsearcher",
"fieldConfigs": [
[
"name" : "default",
"context": [
"projects": [
'SERVERS'
],
]
]
],
"properties" : ["key": "mould", "required": true]
]
])
def customField = customFieldManager.getCustomFieldObjectByName("mould.Xxxxxx")
log.debug customField.getUntranslatedName()
def CUSTOM_FIELD_NAME_FORMAT = "jira.translation.custom.field%s.name.%s"
def cfNameFormat = String.format(CUSTOM_FIELD_NAME_FORMAT, customField.getId(), Locale.UK)
customField.getPropertySet().setString(cfNameFormat, "Xxxxxx")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment