Forums

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

CustomFieldType class don't working correctly. No signature of method

Deleted user
May 21, 2018

Hi,

I want get a Value of CustomField from another issue (in this same project). So I used a code:

def test = "SYS-15949"
def issue = IssueManager.getIssueByCurrentKey(test)
log.debug "Issue $issue"
def Klasaissue = issue.getClass()
log.debug "klasa issue $Klasaissue"

def customFieldName = "SysChangeSubmitters"
def field = customFieldManager.getCustomFieldObjectByName(customFieldName)
log.debug "CustomField $field"
def Klasafield = field.getClass()
log.debug "Klasa field $Klasafield"

def SysChange = CustomFieldType.getValueFromIssue(field,issue)
log.debug "SysChange $SysChange"
def KlasaSysChange = SysChange.getClass()
log.debug "Klasa Sys: $KlasaSysChange "

so the value should be taken here:

CustomFieldType.getValueFromIssue(field,issue)

but i receiving logs with ERROR like here:

2018-05-21 12:01:05,706 DEBUG [LOG]: Issue SYS-15949
2018-05-21 12:01:05,706 DEBUG [LOG]: klasa issue class com.atlassian.jira.issue.IssueImpl
2018-05-21 12:01:05,706 DEBUG [LOG]: CustomField SysChangeSubmitters
2018-05-21 12:01:05,706 DEBUG [LOG]: Klasa field class com.atlassian.jira.issue.fields.ImmutableCustomField
2018-05-21 12:01:05,709 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2018-05-21 12:01:05,709 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: SYS-15948, actionId: 81, file: <inline script>
groovy.lang.MissingMethodException: No signature of method: static com.atlassian.jira.issue.customfields.CustomFieldType.getValueFromIssue() is applicable for argument types: (com.atlassian.jira.issue.fields.ImmutableCustomField, com.atlassian.jira.issue.IssueImpl) values: [SysChangeSubmitters, SYS-15949]
	at Script415.run(Script415.groovy:55)

 

Interesting is that I making getClass() for issue and field and receiveing ERROR that method want exactly this same what i giving... Where is a problem?

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev
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 Champions.
May 21, 2018

Your script should like this:

def test = "SYS-15949"
def issue = IssueManager.getIssueByCurrentKey(test)
log.debug "Issue $issue"
def Klasaissue = issue.getClass()
log.debug "klasa issue $Klasaissue"

def customFieldName = "SysChangeSubmitters"
def field = customFieldManager.getCustomFieldObjectByName(customFieldName)
log.debug "CustomField $field"
def Klasafield = field.getClass()
log.debug "Klasa field $Klasafield"

def SysChange = issue.getCustomFieldValue(field)
log.debug "SysChange $SysChange"
def KlasaSysChange = SysChange.getClass()
log.debug "Klasa Sys: $KlasaSysChange "
Deleted user
May 21, 2018

But then taking value from current Issue - this is not solution. I must have Value from another (SYS-15949).

Alexey Matveev
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 Champions.
May 21, 2018

The script I gave you takes the value from SYS-15949

you defined the issue variable as

def issue = IssueManager.getIssueByCurrentKey(test)

and the test variable is  "SYS-15949"

Deleted user
May 21, 2018

Big thanks! I thought that issue is for current issue and don't working correctly with another - it was mistake. Have a nice day!

Regards,

Wojciech Miecznikowski

Alexey Matveev
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 Champions.
May 21, 2018

You are welcome! Have a good day too :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events