Scriptrunner: Groovy: getCustomFieldObject return ImmutableCustomField

Hi folks,

Need some help and I am stuck in this issue.

When I do ComponentAccessor.getCustomFieldManager().getCustomFieldObject I get back ImmutableCustomField with which I am not able to read or update the custom field value.


def customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField cField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10011")
String val = getCustomFieldValue(cField)



output when I run in console:
2017-11-21 11:47:52,415 INFO [acme.CreateSubtask]: class com.atlassian.jira.issue.fields.ImmutableCustomField

2017-11-21 11:47:52,418 WARN [common.UserScriptEndpoint]: Script console script failed: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getCustomFieldValue() is applicable for argument types: (com.atlassian.jira.issue.fields.ImmutableCustomField) values: [Chargeback Status] at

1 answer

Ahh!! Figured it out myself.


Solution:  You need to have the reference to the issue always either in console or in post function. Only then it works and updates my CustomField.

I don't know behind scenes what is going on but when you do 

getCustomFieldValue(cField)    --> Ouputs the error above
issue.getCustomFieldValue(cField)   --->  Gets me the actual value

What led to this confusion in first place is I kept reading docs where people said there is no need to use "issue" if you are in post function as the scriptrunner already has context of the "issue" but apparently that isn't a sweet route for me.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

445 views 8 26
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you