我想根据Epic的自定义字段更新Epic中的问题,我尝试了一遍又一遍。我需要一些帮助。 def linkType =“史诗般的问题”
def linkMgr = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def event = event as IssueEvent
Issue issue = event.issue as Issue
def accountField = cfManager.getCustomFieldObjects(issue)?.find{it.name == "Account"}
def cfValue = issue.getCustomFieldValue(accountField)
def epicLink = cfManager.getCustomFieldObjectByName("Epic Link")
def epicName = cfManager.getCustomFieldObjectByName("Epic Name")
def change = event?.changeLog?.getRelated("ChildChangeItem")?.find{it.field == accountField}
if (!change){
return
}
def linkedIssue = ComponentAccessor.issueLinkManager.getOutwardLinks(issue.id).findAll{it.issueLinkType.name == linkType}
if (!linkedIssue){
return
}
if (change){
linkedIssue.each{
def linkedIssueObj = it.destinationObject
def oldValue = linkedIssueObj.getCustomFieldValue(accountField)
def newValue = issue.getCustomFieldValue(accountField)
accountField.updateValue(null, linkedIssueObj, new ModifiedValue(oldValue, newValue), new DefaultIssueChangeHolder())
}
}