I'm attempting to set the value of the Team field to the same value as the Parent item on a workflow transition. The Team field is a Portfolio field, and seems to have a different api to Jira custom fields.
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Level
import org.apache.log4j.Logger
Logger log = Logger.getLogger("sr.workflow.project.create")
log.setLevel(Level.DEBUG)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def parentLinkField = customFieldManager.getCustomFieldObjectsByName("Parent Link")
def teamField = customFieldManager.getCustomFieldObjectsByName("Team")
log.debug("Created ${issue.key}")
def parentKey = issue.getCustomFieldValue(parentLinkField).toString()?:null
log.debug("Parent Link: ${parentKey}")
if(parentKey){
def parent = ComponentAccessor.issueManager.getIssueByCurrentKey(parentKey)
def team = parent.getCustomFieldValue(teamField)?:null
if (team){
log.debug("Parent Team: ${team}")
// Set the current issue 'Team' field
issue.setCustomFieldValue(parentLinkField, team)
}
}
And this is the result in the log
groovy.lang.MissingMethodException: No signature of method:
com.atlassian.jira.issue.IssueImpl.setCustomFieldValue() is applicable for argument types:
(com.google.common.collect.SingletonImmutableList, com.atlassian.rm.teams.core.team.data.DefaultTeam) values: [[Parent Link], 461]
Possible solutions: setCustomFieldValue(com.atlassian.jira.issue.fields.CustomField, java.lang.Object), getCustomFieldValue(com.atlassian.jira.issue.fields.CustomField)
at Script237.run(Script237.groovy:22)
I've tried various combinations... none of the successful so thought its time to ask the hive mind :-)
Any suggestions would be welcome.