EazyBI does not track the change history for those fields by default. However, you may add those fields to data import. This solution requires changes in advanced settings and account import options.

1) In advanced settings you may add this piece of code to fetch changes in the “Original estimate”:

[jira.customfield_org_est_h_change]
name = "Original estimated hour changes"
data_type = "decimal"
measure = true
multiple_dimensions = ["Time"]
javascript_code = '''
ortimeEstimateHistory = new Array();
if (issue.changelog && issue.changelog.histories) {
  first_change = true;
  for (var i=0; i < issue.changelog.histories.length; i++){
    var history = issue.changelog.histories[i];
    for (var a=0; a < history.items.length; a++) {
      var item = history.items[a];
      if (item.field == "timeoriginalestimate") {
        if (!item.from) item.from = 0;
      	if (first_change ) {
      		ortimeEstimateHistory.push(issue.fields.created.substring(0, 10) + ',' + parseInt(item.from)/3600);
      		first_change = false;
      	}
      	change=item.to - item.from;
        ortimeEstimateHistory.push(history.created.substring(0, 10) + ',' + parseInt(change)/3600);
      }
    }
  }
}
if ((!ortimeEstimateHistory || !ortimeEstimateHistory[0])&& issue.fields.timeoriginalestimate) {
 	ortimeEstimateHistory.push(issue.fields.created.substring(0, 10) + ',' + parseInt(issue.fields.timeoriginalestimate)/3600);
}
if (ortimeEstimateHistory) {
	issue.fields.customfield_org_est_h_change = ortimeEstimateHistory.join("\n");
}
'''

In import options select import as a Measure for custom field “Original Estimate”.
In reports, you may use this custom field measure “Original Estimated hour changes” along with dimension “Time” to see the value changes in a time.

2) In advanced settings you may add this piece of code to fetch previous “Due Date” values:

[jira.customfield_prevous_duedates]
name = "Previous Due dates"
data_type = "string"
javascript_code = '''
var previousDuedate = new Array();
if (issue.changelog && issue.changelog.histories) {
//  first_change = true;
  for (var i=0; i < issue.changelog.histories.length; i++){
    var history = issue.changelog.histories[i];
    for (var a=0; a < history.items.length; a++) {
      var item = history.items[a];
      if (item.field == "duedate" && item.from) {
        previousDuedate.push(item.from);
        issue.customfield_1 = previousDuedate; // test
      }
    }
  }
}
if (previousDuedate) {
	issue.fields.customfield_prevous_duedates = previousDuedate.join(",");
	issue.customfield_2 = issue.fields.customfield_prevous_duedates; // test
}
'''

In import options select import as a property for custom field “Previous due dates“.
In reports, you may use this issue property “Issue Previous due dates” which represents previous due dates separated by a comma.

3) If you only need to track the first filled “Due Date” to compare the first and the last as Date object

[jira.customfield_prevous_duedates]
name = "Previous Due dates"
data_type = "date"
javascript_code = '''
var previousDuedate = null;
if (issue.changelog && issue.changelog.histories) {
  for (var i=0; i < issue.changelog.histories.length; i++){
    var history = issue.changelog.histories[i];
    for (var a=0; a < history.items.length; a++) {
      var item = history.items[a];
      if (item.field == "duedate" && item.from) {
        previousDuedate = item.from;
        i =  issue.changelog.histories.length;
        a =   history.items.length;
      }
    }
  }
}
if (previousDuedate) {
  var d = previousDuedate.split('-');
  issue.fields.customfield_prevous_duedates = new Date(d[0],--d[1],d[2]);
  //issue.fields.customfield_previous_duedates = previousDuedate;
	
}
'''

Many many thanks to the EazyBI support team! You are awesome!

Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s