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:
- Log in to JIRA as an administrator.
- Go to the Administration icon and click on it.
- Click on
Issues - > Custom fields.
- Click on
Add custom field
. - Click on
Advanced
in the left panel. - Locate
Time in status Field type
and select it. - Click on
Next
. - Provide a name for the custom field
- You can optionally provide a description for the custom field.
- Click on
Create
- Associate the custom field to the appropriate screens.
- Locate the custom field in the Custom fields administration page and click on the cog wheel.
- Click on
Configure
and specify the Status(es) to look for (explained below). - You can create multiple contexts if you need to associate different statuses with particular projects or issue types.
- Perform a re-index as prompted by JIRA.
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:
- Locate the custom field on the Custom Fields administration page.
- Click on the cog wheel and click on
Configure
- Click on
Edit Status(es) to look for.
- Select the status(es).
- Click on
Save.
To remove the status(es) to look for:
- Locate the custom field on the Custom Fields administration page.
- Click on the cog wheel and click on
Configure
- Click on
Edit status(es) to look for.
- Uncheck the status(es) you wish to remove.
- Click on
Save
.
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 as1day, 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
You can define a velocity template that will return the Html representation of the calculated custom field. Leave it empty to use the default template.
To select a format for a Time in status custom field type value;
- Locate the custom field on the Custom Fields administration page.
- Click on the cog wheel and click on
Configure
- Click on
Edit Velocity Template
. - Input the template.
- 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
get("Your custom field name") or get("customfield_xxxxx")
that returns a number in a Double format.getAsString("Your custom field name")
or
getAsString("customfield_xxxxx")
that returns aString
representing the duration in number of seconds