Time Between custom field

The Time Between custom field calculates the duration spent between two specific statuses or events within an issue. It offers flexibility by allowing you to define working calendars, exclude paused statuses, and customize the displayed information.

Creating a Time Between custom field

  1. Navigate to Jira Admin > Manage Apps > Enhancer Plugin For Jira Menu > Custom Fields (JEP).

  2. Click Add New JEP Custom Field and choose Duration.

  3. Select Time Between and click Add custom field. The Create new Time Between custom field screen will appear.

    image-20240209-115704.png

Step 1: Definition

  • Provide a clear name and description which will be shown on the Custom Fields page.

  • Select a working calendar if you want to calculate time according to it. Working calendars can be defined in Jira Admin > Add-ons > Enhancer Plugin Menu > Working Calendars.

Click Next to move on to the Events screen.

Step 2: Events

You can select Start, End, and Pause conditions for the Time Between custom field. Conditions define a point within an issue’s lifetime, such as when the issue was assigned or when the status changed to Open.

  • Select the Start and End events. They can be any status, event (e.g. 'Resolution', 'Reopening'), or date/time custom fields.

For example:

 

 

 

 

  • Under Pause, select the statuses in which you want the timer to pause.

Click Next to move on to the Occurrence screen.

Step 3: Occurrence

  • An Occurrence can be set to display the First or Last occurrence, an aggregated result with a Cumulative option, or even the Largest span (from the very beginning of the original status until the latest target status).

The Occurence option is disabled when at least one of the Start or End events are selected as a Date Custom Field, as the Date Custom Field provides only one date which means there can be only one occurrence.

  • Tick the Latest Origin checkbox to calculate the duration from the latest origin status.

For instance, assume you have a workflow of Open - In Progress - Resolved - Closed, and you want to calculate the working duration from Open to Resolved. If the issue's status has been set to Open - In progress - Open - In Progress - Resolved (in this order) and you want to calculate the amount of time from the latest Open, you should enable the Latest Origin flag. Otherwise, it will calculate from the first Open status in the issue's history.

Click Next and move onto the Time Format screen.

Step 4: Time Format

This screen allows you to select how time will be displayed with which suffix and separator type for the issue main view, navigator view, and board view.

  • Click the Save Custom Field button. And that’s it!

You can define as many Time Between custom fields as you wish. If your Time Between custom field hasn’t met its Start or End condition, the custom field will appear like this:

When the Start and End conditions are met, JEP will start providing the related information. If you want the custom field to show the information regardless, navigate to the Time Format step and check the box that says Show time value even if the start condition is not met.

Editing the custom field:

The recently defined custom field is on the Custom Fields (JEP) screen. You can always edit or delete the custom field by clicking the cog icon.

If you can't see the custom field you created on the issue screen, please make sure you've added it to that screen by navigating to the custom field, clicking the cog icon on the right-hand side, and selecting Screens.

Searching based on this custom field in the issue navigator:

Basic search

Advanced search

Sample results in the issue navigator:

In the default configuration, when exporting to Excel via the issue navigator, the Time Between fields provide comprehensive execution details, including start time, end time, and total duration.

However, this default setting can result in Excel reports that appear cluttered for reporting purposes, with multiple rows for a single issue. To address this, users can modify this behavior by navigating to the JEP Menu and selecting the Advanced Configuration menu item. By unchecking the Show details option and saving the changes, users can obtain a summarized view for Excel exports.

Following this adjustment, the Excel report will now present a more concise format, enhancing the clarity of the exported data.

Before

After

Getting Time Between value via RESTService:

To retrieve the Time Between Custom Field details, make a GET request to the following Jira REST API endpoint:

GET Time Between Custom Field details per issue.

JIRA_URL/rest/jep-api/latest/customfields/timebetween/customfield_xyz?issue=ABC-123 (GET)

Replace "customfield_xyz" with the actual custom field Id and "ABC-123" with the relevant issue key.

Sample output:

{ "totalDurationAsMillis":29018997792, "totalPausedDurationAsMillis":0, "totalWorkingDurationAsMillis":29018997792, "totalWorkingDurationAsFormattedString":"47 weeks, 6 days, 20 hours, 49 minutes, 57 seconds", "executions":[ { "startTime":1540943223822, "endTime":1569962214542, "fromStatus":"10000", "fromStatusString":"To Do", "toStatus":"10001", "toStatusString":"Done", "finalized":true, "totalDuration":29018990720, "totalWorkingDuration":29018990720, "totalPausedDuration":0 }, { "startTime":1569962382226, "endTime":1569962389298, "fromStatus":"10000", "fromStatusString":"To Do", "toStatus":"10001", "toStatusString":"Done", "finalized":true, "totalDuration":7072, "totalWorkingDuration":7072, "totalPausedDuration":0 } ] }

Getting custom field information from the database:

You can use the AO_FDF29B_JEP_ISSUE_TB table to get the information you need from the database.

Table

Column

Definition

Table

Column

Definition

AO_FDF29B_JEP_ISSUE_TB

 

 

 

CREATED_DATE

Date the custom field was created.

 

CYCLE_START_TIME

Time when the Start condition was met.

 

ELAPSED_DURATION_MILLIS

Value of the custom field.

 

END_TIME

Time when the End condition was met.

 

ID

ID of the information stored in the database.

 

ISSUE_ID

ID of the issue.

 

LAST_CALCULATION_TIME

JEP regularly calculates the value of the custom field and adds the information to the database. This shows the last time JEP performed the calculation.

 

PAUSED_DURATION_MILLIS

If there is a Pause condition and it is met, this field displays how long the pause was.

 

PREVIOUS_ELAPSED

If there was numerous cycles, this field shows the value of the latest one.

 

PREVIOUS_PAUSED

If there was numerous cycles, this field shows when the last pause was.

 

START_TIME

Time when the Start condition was met.

 

STATE

Whether the custom field is running or not.

 

TIME_BETWEEN_CONFIG_ID

ID of the custom field.

 

UPDATED_DATE

Date when the issue was updated.