...
where <field_ID> is a built-in JIRA field ID (see this list) or ID or a custom field ID (in the form customfield_nnnnn). See this page for details.
You can also access the JIRA Issue object using the issueObject
variable.
...
where <field_ID> is a built-in JIRA field ID (see this list) or a custom field ID (in the form customfield_nnnnn). See this page for details.
You can also access the JIRA Issue object using the issueObject
variable.
...
Anchor | ||||
---|---|---|---|---|
|
- Create a new custom field, choosing "Calculated Date/Time Field" for its type.
- During step 2, in the Description field, include the calculation formula using the syntax described below.
- 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). See this page for details.
You can also access the JIRA Issue object using the issueObject
variable.
Info | ||
---|---|---|
| ||
|
Note that you must make sure the formula returns a java.util.Date, or null.
Info | ||
---|---|---|
| ||
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). |
Custom formatting
You can also specify a date/time format for the value of the Calculated Date/Time field. In the Description field, add the name of the date/time format using the following syntax:
Code Block |
---|
<!-- @@Format: <format_name> --> |
where <format_name>
is one of the constants found here: https://developer.atlassian.com/static/javadoc/jira/reference/com/atlassian/jira/datetime/DateTimeStyle.html
...