Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,362,076
Community Members
 
Community Events
168
Community Groups

getCustomFieldObject cannot be find in 6.46.0 script runner version

After upgrading to JIRA v8.20.6 and Script Runner 6.46.0 I'm receiving the following error message at workflow post function:

import com.atlassian.jira.issue.CustomFieldManager

def customFieldManager = ComponentAccessor.getCustomFieldManager()

 CustomField Contractor = customFieldManager.getCustomFieldObject("customfield_18102")

Static type checking: Cannot find matching method java.lang.Object#getCustomFieldObject(java.lang.String)

Before the upgrade it worked.

Please help to resolve.

Thanks

2 answers

Hey,

I'm an engineer from the ScriptRunner development team, I just tried pasting the following code into the script console

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager

def customFieldManager = ComponentAccessor.getCustomFieldManager()

CustomField Contractor = customFieldManager.getCustomFieldObject("customfield_18102")

I do not see any errors in the editor for that code on the latest version of ScriptRunner, can you try upgrading to the latest version and see if that remedies the problem?

If it does not, then please get in touch with customer support so we can take a deeper look.

Cheers!

Reece

Hi

 

Can you try ?

 

import com.atlassian.jira.issue.CustomFieldManager

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.CustomFieldManager

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()

CustomField Contractor = customFieldManager.getCustomFieldObject("customfield_18102")

 

There is an error but the script is working fine or not ?

I think the editor is not able to determine which object is returned by getCustomFieldManager. Adding the type should resolve it.

 

Regards

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

5,093 views 18 33
Read article

Atlassian Community Events