Hey!
I would like to copy the value of the Field "Organizations" to a custom field "customer organization" whenever the field "Organizations" is changed. I came as far as the following code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
def customFieldManager = ComponentAccessor.CustomFieldManager
def issue = event.issue
def tgtField = customFieldManager.getCustomFieldObjects(issue).findByName("customer organization")
def calcField = customFieldManager.getCustomFieldObjects(issue).findByName("Organizations")
def newValue = issue.getCustomFieldValue(calcField)
tgtField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField), newValue), new DefaultIssueChangeHolder())
Executing the listener always fails. This is what the logs say:
2020-11-04 15:52:30,517 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2020-11-04 15:52:30,517 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.servicedesk.internal.feature.organization.event.OrganisationsAddedToIssueEventImpl, file: null
groovy.lang.MissingPropertyException: No such property: CustomFieldManager for class: com.atlassian.jira.component.ComponentAccessor
Possible solutions: customFieldManager
at Script76.run(Script76.groovy:5)
Anybody knows a solution for this problem?
best regards,
Clemens