Hi, I would like one custom field value copy to another field in different issue whenever the issue clone (it is cloning from project A issue type X to Project A issue type Y). when I input the key of an issue to run the Groovy script against it (test groovy script), it's run successfully. but when a new issue clone, it does not copy the field value. it's just work on special issue key in test and does not work on every current issue.
Thanks and appreciate your help.
package com.onresolve.jira.groovy.test.scriptfields.scripts
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def totalRemaining = 0
issueLinkManager.getOutwardLinks(issue.id).each {
issueLink ->
log.error (issueLink.issueLinkType.name)
log.error (issueLink.getId().toString())
def x=ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_14862")
log.error(issueLink.getDestinationObject().getCustomFieldValue(x).toString())
issue.setFieldValue("company",issueLink.getDestinationObject().getCustomFieldValue(x).toString())
}