import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.component.ComponentAccessor
log.warn("PARENT JIRA ISSUE: " + issue)
def currentUser2 = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def linkedIssues = ComponentAccessor.issueLinkManager.getLinkCollection(issue, currentUser2).allIssues
def cField = ComponentAccessor.customFieldManager.getCustomFieldObject('customfield_24201')
def cFieldValue = issue.getCustomFieldValue(cField);
log.warn("PARENT ISSUE VALUE: " + cFieldValue)
for (value2 in linkedIssues){
log.warn("LINKED JIRA ISSUE: " + value2)
def issueLinked = ComponentAccessor.issueManager.getIssueByCurrentKey(value2.toString())
log.warn("LINKED JIRA ISSUE PROJECT: " + issueLinked.projectId)
if (issueLinked.projectId == 34343) {
def cField2 = ComponentAccessor.customFieldManager.getCustomFieldObject('customfield_24201')
def cField2Value = issueLinked.getCustomFieldValue(cField2);
log.warn("LINKED JIRA ISSUE FIELD VALUE: " + cField2)
//Here I would like to show value of the customfield of linked issue
log.warn("Value2: " + cField2Value)
cFieldValue += cField2Value
}
}
//log.warn(linkedIssues)
if (cFieldValue == 0) {
return null
}
else {
return cFieldValue
}