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
Hi,
First try changing the declaration of the CustomfieldManager to this:
def customFieldManager = ComponentAccessor.getCustomFieldManager()
Let me know if this (partially) fixes your problem.
Regards,
Jeroen
at least I get no error anymore
I just tried and executed the event the listener should respond to (added an organization to an issue), but it didn't run
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.