Display Account Lead on Jira Issue

Overview

Add a ScriptRunner field to Jira issues as an HTML formatted custom field. A scripted field can be used to display metadata on a selected Tempo account, such as Account Status.

Example

I want to find out who the account lead is for a specific account. I have selected the account from the list of available Tempo accounts, so I can contact them about a problem I have found. This script allows me to find out the name of this person so I can resolve the issue quickly and efficiently.

Good to Know

  • This script requires Tempo Timesheets, or Tempo Budgets by Tempo for Jira.
  • The script only works for screens where the Tempo Account custom field has been added.
  • To configure this script: Create a Custom Script Field with Template: User Picker (single user) and Searcher: User Picker Searcher

Requirements

Jira Jira (7.3 - 7.13)

import com.atlassian.jira.component.ComponentAccessor
import com.tempoplugin.accounts.account.api.Account
import com.tempoplugin.platform.jira.user.JiraTempoUser

import com.onresolve.scriptrunner.runner.customisers.WithPlugin

@WithPlugin(["com.tempoplugin.tempo-accounts"])

def customFieldManager = ComponentAccessor.customFieldManager
def accountField = customFieldManager.getCustomFieldObjects(issue).find { it.name == "Account" }
def account = issue.getCustomFieldValue(accountField) as Account

account ? (account.lead as JiraTempoUser).applicationUser : null
Discovered an issue? Report it here

Suggested for you

Appears in these Collections