Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleDebugging the script

If the calculated field does not show up on the view issue screen, you must make sure the formula isn't raising an error. For that, you must look at the end of the JIRA log file (atliassian-jira.log) right after displaying the issue (displaying an issue will always force calculated fields to be re-calculated).

 

Example
Adding two fields

To add two custom fields, such as "Business Value" and "Technical Value" to get an "Overall Value":

...

Note that you must make sure the formula returns a String, or null.

Exact Text Searcher (Statistics-compatible) (new in 1.5.6)

When creating a Calculated Text Field, you can choose between the standard Free Text Searcher and the new 

Info
titleDebugging the script

If the calculated field does not show up on the view issue screen, you must make sure the formula isn't raising an error. For that, you must look at the end of the JIRA log file (atliassian-jira.log) right after displaying the issue (displaying an issue will always force calculated fields to be re-calculated).

Exact Text Searcher (Statistics-compatible)

...

 (new in 1.5.6)

When creating a Calculated Text Field, you can choose between the standard Free Text Searcher and the new Exact Text Searcher (Statistics-compatible). The latter should be used if you need either of the following:

...

Anchor
calculateddatefield
calculateddatefield
Calculated Date/Time Field (new in 1.5.5)

  1. Create a new custom field, choosing "Calculated Date/Time Field" for its type.
  2. During step 2, in the Description field, include the calculation formula using the syntax described below.
  3. Re-index your data, as JIRA will kindly suggest you to.
Formula syntax

The formula should be included in the field description inside an html comment (so that it remains invisible when showing the field description), preceded by the following keyword: @@Formula: (note the colon at the end). For example:

Code Block
<!-- @@Formula: formula goes here -->

You can naturally include the real description of the custom field as well. For example:

Code Block
This field represents 10 days after the creation of the issue.
<!-- @@Formula: org.apache.commons.lang.time.DateUtils.addDays(issue.get("created"),10) -->

The formula itself is a Java-style expression that can reference any issue field value, include Java operators, and Java method calls (such as the org.apache.commons.lang.time.DateUtils.addDays() example above). Access to issue field values is achieved by the following syntax:

Code Block
issue.get("<field_ID>")

where <field_ID> is a built-in JIRA field ID (see this list) or a custom field ID (in the form customfield_nnnnn).

You can also access the JIRA Issue object using the issueObject variable.

Info
titleTo identify the custom field ID:
  1. go to Administration/Custom Fields
  2. click on the "Configure" link for the custom field you're interested in
  3. in the URL of the Configure Custom Field page, note the number after "customFieldId=" and append it to "customfield_" to build the custom field ID

Note that you must make sure the formula returns a java.util.Date, or null.

Info
titleDebugging the script

If the calculated field does not show up on the view issue screen, you must make sure the formula isn't raising an error. For that, you must look at the end of the JIRA log file (atliassian-jira.log) right after displaying the issue (displaying an issue will always force calculated fields to be re-calculated).

 

Anchor
transitiondatefield
transitiondatefield

...