Help on building a report to track value change history of a custom field

Hi @Amzad ,
It appears that you are using JavaScript custom field “Last date when custom field changed” from the eazyBI documentation.
Here are a few observations and suggestions:

  1. Tracking the last change date: The JavaScript custom field, as its name suggests, is designed to track the last date when a custom field value was changed to a specified value. It does not record all the of changes of the customfield.
  2. Placeholder syntax: '<Customfield name>' and '<Value>' in the script are placeholders. Replace these with the actual custom field name and value used in Jira, without the angle brackets “<>” (unless they are part of your actual field name). Remember, the field and value names are case-sensitive and should exactly match those used in Jira.
  3. Single value last change date: The original script is set up to track changes for only one specific value. If your script includes syntax like “<Gap, Fit, Standard>”, it indicates tracking for multiple values, which is not supported in the provided code.

To track changes for multiple values while still capturing only the last date when the custom field changed to one of these values (var targetValues = ['Gap', 'Fit', 'Standard']), you can use the following code. This script will store the last change date when the custom field was set to one of the defined values in the array.

data_type = "string"
dimension = true
separate_table = true
changes = true

name = "Fit/Gap value change date"
data_type = "date"
measure = true
javascript_code = '''
var customfieldChangeDate;
var targetValues = ['Gap', 'Fit', 'Standard']; // Array of target values
if (issue.changelog && issue.changelog.histories && issue.changelog.histories.length > 0) {
  var histories = issue.changelog.histories;
  for (var i = 0; i < histories.length; i++) {
    var history = histories[i];
    if (history.items && history.items.length > 0) {
      for (var n = 0; n < history.items.length; n++) {
        var item = history.items[n];
        if (item.field == 'Fit/Gap Classification' && targetValues.indexOf(item.toString) > -1) {
          customfieldChangeDate = history.created;
issue.fields.customfield_valuechange = customfieldChangeDate;

If you want to track all changes, then I would suggest checking this solution:

Gerda //

1 Like