Get date worklog was added?

tempo

#1

Is it possible to import the date a worklog was added? We’re trying to track users adding past work. Jira cloud does not send a notification when tempo updates the worklogs, was thinking a list of worklogs by the order they were added, not by the work date, would be useful.


#2

Hi @Majken,

eazyBI can import additional worklog data as a dimension. An other dimension with a date will be of little help to you to pinpoint the worklogs that get created past their starting date.

Instead, you could try to create a dimension that displays the difference in days between the worklogs start and the date it was added. Below are parameters with custom JavaScript code for this dimension:

#Worklog date difference
[jira.customfield_wl_date_difference]
name = "Worklog date difference"
data_type = "decimal"
dimension = true
worklog = true
javascript_code = '''
var start_date = Date.parse(worklog.started);
var create_date = Date.parse(worklog.created);

if (create_date !== start_date) {
  var elapsed = ((create_date - start_date) / (60*60*24*1000)).toFixed(1);
  worklog.customfield_wl_date_difference = elapsed;
}
'''

This will create a new custom field in the eazyBI import settings that you can select for import as a dimension. Once imported, you can find it in the dimension section under the “Worklog” link. Please have a look at a picture of a sample report below:

Best,
Robert // eazyBI staff


#3

Thanks @roberts.cacus . I actually want the date. The PMs will want to know which worklogs have been added since they last reviewed the timesheets. The lag without the creation date will not be informative enough. We’d want a table like:

Issue Key Date created (Sort by this) Worklog Time worked Date worked
ABC-1 2019-03-09 Worked on ABC-1 4h 2019-01-17
2019-03-10 Worked on ABC-1 8h 2019-03-10

#4

Hi @Majken,

In that case please try the JavaScript code below:

# Worklog creation date
[jira.customfield_wl_created_date]
name = "Worklog created date"
data_type = "string"
dimension = true
worklog = true
javascript_code = '''
  if (worklog.created) {
    var wd = new Date(Date.parse(worklog.created));
    var wdate = wd.getDate()
    var month = new Array();
      month[0] = "Jan";
      month[1] = "Feb";
      month[2] = "Mar";
      month[3] = "Apr";
      month[4] = "May";
      month[5] = "Jun";
      month[6] = "Jul";
      month[7] = "Aug";
      month[8] = "Sep";
      month[9] = "Oct";
      month[10] = "Nov";
      month[11] = "Dec";
    var wmonth = month[wd.getMonth()];
    var wyear = wd.getFullYear();
    worklog.customfield_wl_created_date = wmonth + ' ' + wdate + ' ' + wyear
  }
''' 

Please note that it is possible to import worklog data only as a dimension. The report could look similar to the picture below:

The Time dimension would display the date for which the work was logged; the Worklog created date would display the date in which the hours were added.

Kind regards,
Roberts // eazyBI support