Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,733
Community Members
 
Community Events
176
Community Groups

Use Jira Automation to dynamically set Tempo Time Account field with JSON

Hi All,

I am trying to set the Tempo Time add-in's custom field of account using the Jira Automation option to write a JSON. Ideally I want to set the value of the Account using the value of the custom Jira Management Organization field. 

Here is where I am getting hung up, I cannot set the Account field from tempo time at all. I am getting the following error in the logs. 

(Can not deserialize instance of java.lang.Long out of START_OBJECT token at [Source: N/A; line: -1, column: -1] (io.tempo.jira__account))

My json is formatted as follows

{
"update": {
"customfield_10075": [
{
"set": {"id": 2}
}
]
}
}

I have tried calling the field by name and I have tried setting the fields options using their values. 

 

When calling the rest api for the allowable fields, I find my field in the list with the following results

 

  • customfield_10075: {
    • required: false,
    • schema: {
      • type: "option2",
      • custom: "com.atlassian.plugins.atlassian-connect-plugin:io.tempo.jira__account",
      • customId: 10075
      },
    • name: "Account",
    • key: "io.tempo.jira__account",
    • operations: [
      • "set"
      ],
    • allowedValues: [
      • {
        • id: 2,
        • value: "Client1"
        },
      • {
        • id: 5,
        • value: "Client2"
        }
      ]
    },

 

Your help would be greatly appreciated. 

2 answers

So for anyone tracking this, I resolved the initial error message. However you can only set Tempo Time account using the unique key, you cannot use the name of the Account. Therefore there is not a direct way to assign Account based on Jira Service Management custom field Organization. 

In theory a smart person could create a way to use the Org field as an input to look up in a list through smart values the name of the account and return the unique key. However that is beyond my abilities. 

Hello,  @Andy Creech 

Here is a solution on how to set the Account based on Tempo Account's KEY matching JSM Organisation's name, when taken without spaces and in upper case i.e. JSM Organisation name "Test Organization" -> Tempo Account "TESTORGANIZATION"

  • on create (or any other event, depending on what you are already doing)
  • add "send a web request" action, GET, web request body is empty, delay execution until response is received, to:
    https://api.tempo.io/core/3/accounts/{{issue.customfield_11500.name.remove(" ").toUpperCase().urlEncode}} 
    you will have to specify "Authorization" token as
    Bearer xxxx
    for xxx value go to your Jira Cloud/Apps/Tempo/Settings/API integration and create a token
  • add "edit the issue" action, don't select any fields, instead open up More options, uncheck email sending, specify this in JSON 
    {
        "fields": {
            "Account": {{webhookResponse.body.id}}
        }
    } 

     

The resources to read through are these:

https://tempo-io.atlassian.net/wiki/spaces/KB/pages/2249589149/Handling+time+buckets

https://apidocs.tempo.io/ (you need /accounts/{key} one)

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/

https://support.atlassian.com/cloud-automation/docs/debug-an-automation-rule/

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events