We have finally tested and implemented the following snippet to be used in the Incoming script:
def setTeamField = {
String targetTeam ->
def var = replica.customFields."Team"?.value?.description?.shareable?.asBoolean
def pluginAccessor = com.atlassian.jira.component.ComponentAccessor.getPluginAccessor()
def teamsPlugin = pluginAccessor.getEnabledPlugin("com.atlassian.teams")
if (teamsPlugin == null) {
//no teams plugin
return
}
def teamsCl = teamsPlugin.classLoader
def teamsCa = teamsPlugin.containerAccessor
def tservClass = teamsCl.loadClass("com.atlassian.rm.teams.api.team.FullEnrichedTeamService")
def _DefaultTeamDescription = teamsCl.loadClass("com.atlassian.rm.teams.api.team.data.DefaultTeamDescription")
def _Optional = teamsCl.loadClass("com.google.common.base.Optional")
def tserv = teamsCa.getBeansOfType(tservClass).first()
def teamIds = tserv.getTeamIdsWithoutPermissionCheck()
def teams = tserv.getTeams(teamIds)
def team = teams.find { t -> t.description.title == targetTeam } //?: createTeam()
//debug.error("this is the result of the team field: ${team}")
issue."Team" = team
}
def targetTeam = replica.customFields."Team"?.value?.description?.title?.asString ?: "Team3" //change for default team to be set if no team field value is sent from the remote side
if(firstSync && replica.project.key == "KANS"){
issue.projectKey = "KAN"
issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
setTeamField(targetTeam) //Method to be called to set the field
}
The field can be sent in the outgoing script like this:
Yes im trying with this, but Team field is specific from Jira Roadmaps and also type of this field is Team field type in custom fields. Than i dont know what to choose and how to set default value for this field.
Jose Lobo commented on 24 September 2021
What type of field is it? (free text, select list, radio button, checkbox)
Michal Sitkey commented on 27 September 2021
Its reason why im writing this question. Team field is from Jira Roadmaps addon and in custom fields tab have custom field type TEAM …Nothing from these what you write.
Francis Martens (Exalate) commented on 13 March 2022
Hi Michal Sitkey
So - what you need is a way to know what the default value is for the team name?
Michal Sitkey commented on 14 March 2022
No we need to team field a default value from connector inside of Exalate to overcome validator what is checking if team is presented inside of Issue. Than team must be set in process of creating of issue.