Blog from June, 2020

This page constitutes random notes from my work day as an Atlassian product consultant, put up in the vague hope they might benefit others. Expect rambling, reference to unsolved problems, and plenty of stacktraces. Check the date as any information given is likely to be stale.

As of Tempo 10.19.0 this problem is fixed.See edit inline.


Tempo has a Team custom field. Here it is rendered in the Issue Navigator:

Sadly, if you view Team in CSV you get:

And likewise the view in the Excel-like Issue Editor plugin:

I have reported this as a bug to Tempo (10.17.x) but it's basically "Won't Fix". The field's native representation (i.e. issue.getCustomFieldValue() ) is a String like "52".

Edit: This is now fixed. In Tempo 10.18 and earlier, issue.getCustomFieldValue() returned a String like "52". In Tempo 10.19+ you now get a com.tempoplugin.team.api.TeamImpl  object back, whose toString()  returns the team name.

While that fixes the CSV export, for me it doesn't fix 'Issue Editor' values, which are still numbers. Perhaps I am just experiencing caching or some sort, or perhaps the Issue Editor plugin is doing something else weird. I'll update as I discover more.


Fortunately we have ScriptRunner. Here is source for a Script Field called Tempo Team Name which renders the actual team name:

/**
 * '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
 * jeff@redradishtech.com, 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)

Here it is:

This field can now be used in CSV and Issue Editor views to see the team names.