Hi guys,
I am trying to copy a custom field value from one issue to another linked issue.I can get find the linked issue object of the kind I want and can retrieve the value of the custom field from the first issue however I am struggling to set it on the linked issue. I understand I need to give it an "option" as its a select list, I've tried the way I set a checkbox but this was unsuccessful. would you be able to review my code and give me some pointed on what I need
def issueManager = ComponentAccessor.getIssueManager()
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def projectMgr = ComponentAccessor.getProjectManager()
CustomFieldManager fieldmgr = ComponentAccessor.getCustomFieldManager();
IssueManager issueMgr = ComponentAccessor.getIssueManager();
def customFieldManager = ComponentAccessor.getCustomFieldManager();;
def issue = issueMgr.getIssueObject("issuekey")
def linkedIssue;
issueLinkManager.getInwardLinks(issue.id).each {issueLink ->
if (issueLink.issueLinkType.name == "link name") {
linkedIssue = issueLink.getSourceObject()
}
}
//return linkedIssue
def cfname = customFieldManager.getCustomFieldObjectByName("customfieldname")
def cfragval = issue.getCustomFieldValue(cfname)
linkedIssue.setCustomFieldValue(cfname, cfragval)
Sorry should have said that I am using the same custom field on both issues, just want to transfer the value accross from one to the other linked issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.