Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Listener: Copy Organizations to a custom field


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

Anybody knows a solution for this problem?

best regards,


1 answer


First try changing the declaration of the CustomfieldManager to this:

def customFieldManager = ComponentAccessor.getCustomFieldManager()

Let me know if this (partially) fixes your problem.




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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

Security Advisory for Jira Service Management

On October 20, 2021, Atlassian published a security advisory for Jira Service Management. The full advisory is available at this link.  We've seen a number of questions already asking for...

321 views 1 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you