Skip to content

Instantly share code, notes, and snippets.

@jechlin
Created January 15, 2013 21:39
Show Gist options
  • Save jechlin/4542341 to your computer and use it in GitHub Desktop.
Save jechlin/4542341 to your computer and use it in GitHub Desktop.
package examples
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
Issue issue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("Country")
def targetField = customFieldManager.getCustomFieldObjectByName("Unique ID")
def cfValue = issue.getCustomFieldValue(customField) ?: "NONE"
def changeHolder = new DefaultIssueChangeHolder();
targetField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(targetField), cfValue + "-" + issue.id.toString()), changeHolder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment