Availability
This routine is available starting with katl-commons 1.0.
Starting with version 4.0.0, the second parameter can be custom field id.
This routine is available for Jira server and cloud deployment options.
Syntax
fieldHistory(key, history_field_name_or_id)
Description
Returns all the pairs date + value for the selected field from the selected issue's history.Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
issue key | String | Yes | Key of the selected issue. |
field name or id | String | Yes | Name or the id of the selected field. |
Return type
string []
The return value is an array of strings. The strings come in pairs. The first value is a date representing the time when the value was modified and the second value is the content of the requested field at that date.
Example
//values for field Amount are 2000 at 12.02.2011, 3000 at 13.03.2011 and 4000 at 10.05.2011 string field_name; string[] field_history; field_name = "Amount"; field_history = fieldHistory(key, field_name);
Result: |12/02/2011|2000|13/03/2011|3000|10/05/2011|4000
//values for field Amount are 2000 at 12.02.2011, 3000 at 13.03.2011 and 4000 at 10.05.2011 string field_name; string[] field_history; field_history = fieldHistory(key, customfield_10101); //customfield_10101 = Amount
Result: |12/02/2011|2000|13/03/2011|3000|10/05/2011|4000
Notes
- Besides the labels of the custom fields, the name of the standard Jira fields (summary, assignee, and so on) can be used as parameters.
- If it returns an empty array, you must get the last value of the field from the issue.
- The second parameter is the field name as it appears in history or the custom field id.
See also