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?
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 "
But then taking value from current Issue - this is not solution. I must have Value from another (SYS-15949).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are welcome! Have a good day too :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.