Skip to content

Instantly share code, notes, and snippets.

@jefft
Created June 23, 2020 06:23
Show Gist options
  • Save jefft/17a5270d51c685ee4d0c678dc9cc3b4e to your computer and use it in GitHub Desktop.
Save jefft/17a5270d51c685ee4d0c678dc9cc3b4e to your computer and use it in GitHub Desktop.
ScriptRunner script field that renders the name of the issue's Tempo Team.
/**
* 'Tempo Team Name' script Field that renders the issue's Tempo Team name, if any.
* The plain tempo 'Team' field renders as an integer in CSV and Issue Editor views.
* Use this field instead to render the team name.
*
* https://www.redradishtech.com/pages/viewpage.action?pageId=24641537
* [email protected], 23/Jul/20
*/
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
def customFieldManager = ComponentAccessor.customFieldManager
def teamField = customFieldManager.getCustomFieldObjects(issue).find { it.name == "Team" }
if (!teamField) return;
def team = issue.getCustomFieldValue(teamField)
if (!team) return;
@WithPlugin("com.tempoplugin.tempo-teams")
import com.tempoplugin.team.api.TeamManager
import groovy.transform.Field
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
@Field TeamManager teamManager
teamManager = ScriptRunnerImpl.getPluginComponent(TeamManager)
teamManager.getTeamName(team)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment