Forums

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

Error with custom fields and field behaviour

Josep M. Cao June 7, 2018

Hi everyone!

I have a script that retrieves 2 custom fields to calculate a third one. Is an easy script that works in my pro environment (Jira 7.3.6, scriptrunner 5.0.14), but when I execute this in my dev environment (Jira 7.8.2, scriptrunner 5.3.26), I'm getting this error:

The return type of java.lang.Object getCustomFieldManager() in PriorityMatrixSetter is incompatible
with com.atlassian.jira.issue.CustomFieldManager in com.onresolve.jira.groovy.user.FieldBehaviours

 

Anyone knows anything about this error?

Thanks!

1 answer

0 votes
Mark Markov
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.
June 7, 2018

Hello @Josep M. Cao

It seems like you retriving customFieldManager via scriptrunner method getCustomFieldManager().

Try to use ComponentAccessor instead.

import com.atlassian.jira.component.ComponentAccessor

def customFieldMManager = ComponentAccessor.getCustomFieldManager()  
Josep M. Cao June 7, 2018

No, I'm using component accessor. Here is the initial part of my code:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import org.apache.commons.lang3.StringUtils

import static com.atlassian.jira.issue.IssueFieldConstants.PRIORITY
import common.Utilities

public class PriorityMatrixSetter extends FieldBehaviours {


def run() {
def customFieldManager = ComponentAccessor.customFieldManager
def optionsManager = ComponentAccessor.optionsManager

-------MORE STUFF-----

}

Suggest an answer

Log in or Sign up to answer