Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

getCustomFieldObject cannot be find in 6.46.0 script runner version

Анна Шварцман August 11, 2022

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

0 votes
Reece Lander [ScriptRunner - The Adaptavist Group]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2022

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

0 votes
Florian Bonniec
Community Champion
August 11, 2022

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