Set tempo account field

Bartłomiej F. Tajchman July 31, 2019

Hi, how is the best way to set tempo account field when creating an issue? I have several issue types and I'd like to set them: issueType1 -> account1, issueType2 -> account2 during creation an issue. How to do it?

1 answer

1 accepted

0 votes
Answer accepted
Tom _Automation Consultants_
Atlassian Partner
July 31, 2019

If they all have the same workflow create a post function at the Create transition, which will be an if/else statement with all the different issue types

 

import com.atlassian.jira.component.ComponentAccessor

// Define the id's of the tempo accounts here
def account1 = 1
def account2 = 2

// Define the Tempo Account custom field
def tempoAccField = ComponentAccessor.getCustomFieldObjectsByName("Tempo Account").head()


if(issue.getIssueType().getName().equals("IssueTypeA")){

issue.setCustomFieldValue(tempoAccField, account1)

} else if(issue.getIssueType().getName().equals("IssueTypeB")){

  issue.setCustomFieldValue(tempoAccField, account2)

 You can find the id's of the account in the Tempo Accounts section, if you click on the Tempo Team there will be an id in the URL. e.g.

"/secure/Tempo.jspa#/accounts/account/2/"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events