Sum of Tempo billable hours

Use case

Calculate the total billable hours logged with Tempo in the current issue.

🛠️ Configuration

Create a new Remote action in Jira administration > Manage apps > Remote actions.

Name the new remote action Get Tempo billable hours.  

Select the POST method

Select the current instance as the default connection.

Enter the following REST path.

REST path
Bash
/rest/tempo-timesheets/4/worklogs/search

Enter the following action body in Advanced text mode.

Action body
Bash
"{
  'taskKey': [
    '"+%{issue.key}+"'
  ]
}"

You can optionally use the parameters from  ("YYYY-MM-DD") and to ("YYYY-MM-DD") to request only work logs in a specific time frame.

Create a new Calculated Number Field (by JWT) custom field.

Name the calculated field Billable hours.

Providing a description will help you to identify what the custom field does.

Parser expression

Add the following expression.

Math expression for Calculated Number field:
Bash
toNumber(sum(toNumberList(executeRemoteAction("Get Tempo billable hours", "body[*].billableSeconds"),","))) / 3600