Hello,
I am trying to create a report that will show me the changes in a custom date field between the current and previous months. I Did find the answer below on getting the history of a date field and that is farther along than i was. It does have a bug where it is 1 day behind the actual date on the issue though. And it dsiplays EVERY issue wheras i only need the data from issues that have changed between the current and previous months.
Hi @Brian_Jones1,
You might want to use a slightly different JavaScript calculated custom field that woudl indicate issues with the changed date field and when those changes were done.
You might want to create a numeric custom field like “XXX date changed” that woudl count changes in the date field, and used together with the Time dimension would show on which date the changes were made. Using this setup, you can filter data with “Time” dimension.
The report might look like in the picture below:
The code for JavaScript calculated custom field might look like this:
[jira.customfield_datexxchanged]
name = "XXX date changed"
data_type = "integer"
measure = true
multiple_dates = true
javascript_code = '''
var datechanges = new Array();
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];
//enter here the date field name for XXX date
if (item.field == 'XXX date') {
//change date + counter for change
datechanges.push(history.created.toString().substr(0,10) + "," + 1);
}
}
}
}
};
issue.fields.customfield_datexxchanged = datechanges.join("\n");
'''
Please refer to the documentation for more details on how to construct and validate the JavaScript calculated custom fields: JavaScript calculated custom fields.
Best,
Zane // support@eazyBI.com