Timetracker API for Scriptrunner
[Timetracker]

Scriptrunner is one of the most successful automation tools for Jira. It lets you write groovy scripts for many automation jobs, transitions, scripted fields, etc.
Now Scriptrunner is able to script other plugins with the help of two annotations if they have the necessary services and API-s.
We implemented these services to give you the possibility to use Timetracker with your scripted/automated processes. Below we gathered some examples to show you how Scriptrunner and Timetracker can work together to accomplish what you need, for example:
-
Add worklog with validation: how to log time using Timetracker API so it’s validations will be applied to the new worklogs
-
Worklog category summary on Issue screen: How to implement a scripted field that summarizes worklogs on Issue screen based on the selected attribute
-
Worklog cost summary on Issue screen: How to implement a scripted field that summarizes cost on Issue screen for that Issue
Examples
Add worklog with validation
Timetracker has numerous validation rules, permissions and additional attributes that apply when we create a worklog with it. Below is an example of how they can be used when we log time in a transition with a post-function.
This is a script workflow post-function, the code is:
Worklog attribute summary on Issue screen
Timetracker allows you to add additional attributes to your worklogs. You can use this categorization for example if you have an external and internal project as well, and you want to separate the “Billable” and “Not Billable” worklogs. Sometimes it can be useful to see the total time for each category on an Issue so below is an example of how to do it.
Create a custom scripted field and paste the following script:
In this scripted field, the categorySummary() function returns long type. Based on the parameters, the logged time is summarized and it will return in seconds.
Selecting the Duration (time-tracking) custom script field template for this field will ensure a better time unit display.

Worklog cost summary on Issue screen
The costs involved are at least as important in project management as the logged times. To help you plan your future projects even better and analyze the cost of previous projects or features, Timetracker provides cost management functionality. You can add cost rates to each employee so besides the total time needed to finish a project or feature, you can also check how much it cost.
To calculate and display the cost of an issue for everyone who worked on it, create a custom scripted field and paste the following script:
You can find and try our Timetracker app for free on the Atlassian Marketplace.
Disclaimer:
This blog post originally appeared on EverIT's blog on 2020.02.25. EverIT has joined catworkx (part of TIMETOACT GROUP) on 2025.01.01.