How can i show the change history of date custom field?

Hi,
I trying to see the changes in each date that updated the date custom field “Estimate end date”.
Actually for the defined custom field, only appears the updated last value for all dates. But using the “Hours Spent” Measure show the hours saved for each day.

I tried to obtain the resoult throug this measure:

measure

But for do that is necessary import the custom field like a dimension as a string. If I doing this, is impossible use for calculations or obtain timeline views.

Have you any suggestion to obtain the date custom field change history (keeping the format)?

Thank you so much.

Best regards,
Sergi Macià

Hi,

Date-picker custom fields can not be imported as dimensions in eazyBI.
eazyBI does not allow importing another dimension with date type since there is already one “Time” dimension by default.
A workaround would be using a pre-calculated field (using Javascript in advanced settings) that returns the string output for every issue with all the dates and new timestamp when it was changed (see attachment with table report)
Then using MDX calculated measure this timestamp is converted to Date (see all attached images) and shown for each time period

Try this code for the Javascript code:

[jira.customfield_eetch]
name = "Estimated end timestamp changes"
data_type = "decimal"
measure = true
multiple_dates = true
javascript_code = '''
dateChangeStrings = [];
whenDateChanged = issue.fields.created; //.toString().substr(0,10);
newDateChange = null;
duedateAsTimeChangeStamp = null;
issue.changelog.histories.forEach(function(history){
 history.items.forEach(function(historyItem){
  if (historyItem.field == "Estimated End Date" ) {
   newDateChange = historyItem.from;
   if(newDateChange){
     duedateAsTimeChangeStamp = Date.parse(newDateChange);
     dateChangeStrings.push(whenDateChanged.toString().substr(0,10) + "," + duedateAsTimeChangeStamp/1000);
     dateChangeStrings.push(history.created.toString().substr(0,10) + "," + -duedateAsTimeChangeStamp/1000);
   }
   whenDateChanged = history.created;
  }
  });
});
if (issue.fields.customfield_NNNNN) {
  dateChangeStrings.push(whenDateChanged.toString().substr(0,10) + "," + 
  Date.parse(issue.fields.customfield_NNNNN)/1000) ;
}
issue.fields.customfield_eetch = dateChangeStrings.join("\n");
'''

And then the following code for MDX calculated measure “Estimated end history” (with Month Day Year format) when the pre-calculated field is selected via import options and imported as measures

TimestampToDate(NonZero(Sum(
  {PreviousPeriods([Time].CurrentHierarchyMember), [Time].CurrentHierarchyMember},
   [Measures].[Estimated end timestamp changes]
)))

Martins / eazyBI team.

1 Like

I cannot get this code to work. I am striving to create a report that shows Epic due date change history, to include the previous value and the date of the change. I’m trying to use the guidance above, but no luck. Is there an example report I could look at?

When I use the code above, the value in the custom field shows as:
2022-05-26,1672358400

But the history of the field is:
blank - > 09/21/22 on 7/18/22
09/21/22 → 12/30/22 on 9/22/22
Current due date value = 12/30/22

Please advise!

Code used to create the custom field is as follows:
[jira.customfield_ddc]
name = “due date changes”
data_type = “decimal”
measure = true
multiple_dates = true
javascript_code = ‘’’
dateChangeStrings = [];
whenDateChanged = issue.fields.created; //.toString().substr(0,10);
newDateChange = null;
duedateAsTimeChangeStamp = null;
issue.changelog.histories.forEach(function(history){
history.items.forEach(function(historyItem){
if (historyItem.field == “Due Date” ) {
newDateChange = historyItem.from;
if(newDateChange){
duedateAsTimeChangeStamp = Date.parse(newDateChange);
dateChangeStrings.push(whenDateChanged.toString().substr(0,10) + “,” + duedateAsTimeChangeStamp/1000);
dateChangeStrings.push(history.created.toString().substr(0,10) + “,” + -duedateAsTimeChangeStamp/1000);
}
whenDateChanged = history.created;
}
});
});
if (issue.fields.duedate) {
dateChangeStrings.push(whenDateChanged.toString().substr(0,10) + “,” +
Date.parse(issue.fields.duedate)/1000) ;
}
issue.fields.customfield_ddc = dateChangeStrings.join(“\n”);
‘’’

@TJohnson

Please reach out to support@eazybi.com and provide the Rest API results for the issue where we can see all the changes that were made to your Due Date field.

Aren’t you mixing the custom field “Due Date” with Jira standart field “Due date”?

Martins / eazyBI

Got a working report with a different approach. YAY!
Question though…can you change the date format in the array?
It currently shows on the report as yyyy-mm-dd but I would prefer it show as mm/dd/yy

Here is the code:
data_type = “text”

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(history.created.substr(0,10));
}
}
}
}
if (previousDuedate) {
return previousDuedate.join(“\n”);
}

@TJohnson

If this is the datevalue:
“2017-03-08T12:57:03.000+0200”

The following codeline returns the first ten characters of a full date

history.created.substr(0,10)

And that is what is returned as a result: 2017-03-08
It is not formatted at all. Just first ten characters are returned.
If you want to display it with different format, I guess you need to add some JS functions that read each element (year/month/day) separately from the first then characters and then concatenate them together.

You could try something like this:

previousDuedate.push(history.created.substr(5,2)+"/"+history.created.substr(8,2)+"/"+history.created.substr(2,2));

Martins