A Time in status custom field type represents a duration and is displayed either as a duration String or as a number in a Long format representing the number of seconds. It is a read-only field. |
To add a Time in status custom field type to your instance:
Issues - > Custom fields.
Add custom field
.Advanced
in the left panel. Time in status Field type
and select it.Next
.Create
Configure
and specify the Status(es) to look for (explained below).By default, durations are stored with a precision of one second. If you'd like a lower precision, you can round up values to the nearest minute, hour, day or week, which will impact how values are displayed both on individual issues and on the statistics dashboard gadgets. To round up values select the unit from the Precision field. The default is One second.
Here are a few examples that help you in understanding further.
Example 1: If the calculated duration field evaluates to 174930 seconds, then with One-minute precision, the value is rounded off to 174960.
Precision | Stored value | Duration searcher (24x7 durations) | |||
---|---|---|---|---|---|
Default - One second | 174930 | 2 days, 35 minutes
| 1 week, 1 day, 35 minutes
| ||
One minute | 174960 | 2 days, 36 minutes | 1 week, 1 day, 36 minutes | ||
One hour | 176400 | 2 days, 1 hour | 1 week, 1 day, 1 hour |
If the calculated duration field evaluates to 1494175 seconds which accounts to 2 weeks, 3 days, 7 hours, 2 minutes, 55 seconds or 10 weeks, 1 day, 7 hours, 2 minutes, 55 seconds (depends on the searcher) with the following precisions
Precision | Stored value | Duration searcher (24x7 durations) | |
---|---|---|---|
Default - One second | 1494175 | 2 weeks, 3 days, 7 hours, 2 minutes Rounding: Jira doesn't display the seconds (55 sec in this case) | 10 weeks, 1 day, 7 hours, 2 minutes Rounding: Jira doesn't display the seconds (55 sec in this case) |
One minute | 1494180 | 2 weeks, 3 days, 7 hours, 3 minutes Rounding: The 55 seconds is rounded off to one minute | 10 weeks, 1 day, 7 hours, 3 minutes Rounding: The 55 seconds is rounded off to one minute |
One hour | 1494000 | 2 weeks, 3 days, 7 hours Rounding: The 3 minutes are ignored and the value is rounded off. | 10 weeks, 1 day, 7 hours Rounding: The 3 minutes are ignored and the value is rounded off. |
One day | 1468800 | 2 weeks, 3 days Rounding: The 7 hours are rounded off to 8 hours. | 10 weeks, 2 days Rounding: The 7 hours are ignored and the value is rounded off. |
One week | 1209600 | 2 weeks Rounding: The 3 days are ignored and the value is rounded off. | 10 weeks Rounding: The 3 days are ignored and the value is rounded off. |
In the issue detail view, the Time in status custom field displays the total time spent by the issue in any of the configured statuses. You can choose to display instead the breakdown of the time spent in each status along with the total time spent, by selecting the Time spent in each status
option.
When this option is not selected, the breakdown of the time spent in each status is displayed when the user hovers over the custom field value.
In the issue list view, the Time in status custom field displays the total time spent in any of the configured statuses by the respective issue. You can choose to display instead the breakdown of the time spent in each status along with the total time spent, by selecting the List View
Time spent in each status
option.
When creating a Time in status custom field type, you can configure the Search template as
Using these searchers you will be able to search for issues within a range of values for that custom field. The default search template is Duration searcher (24x7 durations). If you select “None”, then you won’t see any reference to this field in the Issue Navigator search fields. Note that changing a custom field searcher requires a re-index.
Duration searcher (24x7 durations) is a custom statistics compatible searcher provided by JMCF that allows Duration type custom fields of JMCF to be used in the statistics gadgets. See here for more information.
To specify the status(es) to look for:
Configure
Edit Status(es).
Save.
You can also configure the custom field to look for the current status by selecting the current status in the configuration. |
To remove the status(es) to look for:
Configure
Edit status(es) to look for.
Save
.If you select "CURRENT STATUS", the field returns the time spent in the current status since the last status change. For example, you configure the custom field to look for the current status and the issue is in the "Done" status. If the issue has been in the Done status three times, the custom field will return just the time spent in the "Done" status since the last time the issue last entered the status, instead of the total time spent (three times) in the "Done" status. |
For a Time in status field, the Search Template also determines how durations are displayed, and how duration strings returned by the formula are parsed. By default, the search template is Duration searcher (24x7 durations). However, you can customize it by changing the Search template. When you select the template,
144000
seconds is displayed as 1day, 16hours
.You can define a velocity template that will return the Html representation of the calculated custom field on issue detail view. Leave it empty to use the default template.
To select a format for a Time in status custom field type value;
Configure
Edit Velocity Template
.Save.
You can use the following Velocity variables in the template:
$value
: the raw field value, the number of seconds$formattedValue
: the field value formatted according to the field configuration aboveFor example:
<div style="border: dashed"> $formattedValue </div> |
displays the formatted value of the field with a dashed border.
You can define a velocity template that will return the Html representation of the calculated custom field on search list views. Leave it empty to use the default template.
To select a format for a Time in status custom field type value;
Configure
Edit Velocity Template
.Save.
You can use the following Velocity variables in the template:
$value
: the raw field value, the number of seconds$formattedValue
: the field value formatted according to the field configuration aboveFor example:
<div style="border: dashed"> $formattedValue </div> |
displays the formatted value of the field with a dashed border.
Display the Time in status custom field type on Transition and Edit screen
The Never show on Transition and Edit screens
option controls whether the Time in status custom field can appear on transition and edit screens. If you select this option, the field will not be visible on any Edit or Transition screen, even if it is added to the screen.
Access the Time in Status custom field from other Groovy scripts
You can access this field using any of the following getters of the Issue interface
that returns a number in aDoubleformat.get("Your custom field name") or get("customfield_xxxxx")
getAsString("Your custom field name")
or
getAsString("customfield_xxxxx")
that returns a String
representing the duration in number of seconds