Time in status custom field type

NEW IN JMCF 2.0.0

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.

Adding a Time in status custom field type

To add a Time in status custom field type to your instance:

  1. Log in to JIRA as an administrator.
  2. Go to the Administration icon  and click on it.
  3. Click on Issues - > Custom fields.
  4. Click on Add custom field.
  5. Click on Advanced in the left panel.
  6. Locate Time in status Field type and select it.
  7. Click on Next.
  8. Provide a name for the custom field
  9. You can optionally provide a description for the custom field.
  10. Click on Create
  11. Associate the custom field to the appropriate screens.
  12. Locate the custom field in the Custom fields administration page and click on the cog wheel.
  13. Click on Configure and specify the Status(es) to look for (explained below).
  14. You can create multiple contexts if you need to associate different statuses with particular projects or issue types.
  15. Perform a re-index as prompted by JIRA.

Precision

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.

PrecisionStored valueDuration searcher (24x7 durations)
Default - One second174930

2 days, 35 minutes

Jira will not display the seconds (30 sec in this case)

1 week, 1 day, 35 minutes

Jira will not display the seconds (30 sec in this case)

One minute1749602 days, 36 minutes1 week, 1 day, 36 minutes
One hour1764002 days, 1 hour1 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

PrecisionStored valueDuration searcher (24x7 durations)
Default - One second1494175

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 minute1494180

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 hour1494000

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 day1468800

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 week1209600

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.

Search template

When creating a Time in status custom field type, you can configure the Search template as 

  • Duration searcher (24x7 durations) Allows searching for a duration. Durations are considered as calendar durations. Supports Statistics Gadgets.
  • Number range searcher - Allows searching for a number that is in a given range.

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. 

Specifying the status(es) to look for

To specify the status(es) to look for:

  1. Locate the custom field on the Custom Fields administration page.
  2. Click on the cog wheel and click on Configure
  3. Click on Edit Status(es).
  4. Select the status(es).
  5. Click on 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:

  1. Locate the custom field on the Custom Fields administration page.
  2. Click on the cog wheel and click on Configure
  3. Click on Edit status(es) to look for.
  4. Uncheck the status(es) you wish to remove.
  5. Click on 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.


Customizing the formatting of the Time in status custom field value

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,

  • Duration searcher (24x7 durations), the duration is displayed in general duration format, where a day has 24 hours. For example, 144000 seconds is displayed as 1day, 16hours.
  • Number of seconds, the duration is displayed as a number in a Long format representing the number of seconds.
  • None, the duration is displayed in general duration

Customizing the display of the Time in status custom field value on issue detail view

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;

  1. Locate the custom field on the Custom Fields administration page.
  2. Click on the cog wheel and click on Configure
  3. Click on Edit Velocity Template.
  4. Input the template.
  5. Click on 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 above
  • and other variables described on this page

For example:

<div style="border: dashed">
  $formattedValue
</div>

displays the formatted value of the field with a dashed border.

Customizing the display of the Time in status custom field value on the search list view

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;

  1. Locate the custom field on the Custom Fields administration page.
  2. Click on the cog wheel and click on Configure
  3. Click on Edit Velocity Template.
  4. Input the template.
  5. Click on 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 above
  • and other variables described on this page

For example:

<div style="border: dashed">
  $formattedValue
</div>

displays the formatted value of the field with a dashed border.

Displaying 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.

Accessing 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