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())
}
Hi @Hajar Rahimi ,
welcome to the Atlassian Community!
Where exactly is your script inserted, when it doesn't work? Is it a post function in workflow?
How exactly do you do the clone operation? Do you use the ScriptRunner's "Clones an issue, and links" post function? Or is it the standard Jira clone functionality?
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.