'Time to first response’ / exclude attachments/reporter comments being counted as first comments

Hi eazyBI Support/Community

My first writing here, please bare with me :wink:

I have created ‘Time to first comment’ custom field according to this post in the community: Creating a Time to First Comment date.

So far so good…

The issue I’m now experiencing is that whenever a new ticket is opened and the reporter adds an attachment, the attachment is apparently added by the system after the ticket has been opened and JIRA is counting that as the first comment.

Since we’re monitoring this ‘Time to first comment’ custom field for SLA measurement the metrics obviously gets quite skewed.

Would you know a way to either exclude attachments from counting as a comment, or how to exclude the reporters comments from being counted as first comments?

Appreciate any thoughts and/or tips,

Best regards,

Caj

Hi @dodge365
Welcome to the eazyBI community.

You could try a slightly different version of Javascript to find the first comment added by user who is not also a reporter of the issue.

[jira.customfield_firstcommentdate]
name = "First comment date"
data_type = "date"
javascript_code = '''
if (issue.fields.comment && issue.fields.comment.comments 
    && issue.fields.comment.comments.length > 0) {
  var commentsarray = issue.fields.comment.comments;
  for (var i = 0; i < commentsarray.length; i++) {
    var commenthist = commentsarray[i];
    if (commenthist.author && 
        commenthist.author.key != issue.fields.reporter.key) {     
          var admincomment = commenthist.created.substr(0, 10);
          break;
        }
  }
  issue.fields.customfield_firstcommentdate = admincomment;
}
'''

Note that changing the Javascript for an already imported custom field would require double imports (one import without field selected, second with field selected again) to reset the code

Martins / eazyBI

Thanks for the solution @martins.vanags

Best regards,
Caj

Hi, this is Constanze.
I have a similar task:
We also want to retrieve the ‘Time to first Response’ from the comment field (date and time), if certain employees submit a comment.
This timestamp should be visible in a dashboard or a corresponding report.
Challenge: We cannot use a custom field.
Is there still a way to realize this with eazy.BI?
Would be great if you could help me with that.
Best regards,
Co

Hi @Co225

Please explain more about this requirement.
What timestamp are you looking for? Is it the timestamp from the very first comment (made by the first user), or is it the first timestamp for each user who made the comment?
Could you please share an example of how such a report would look like when it is built (which dimensions in rows, page filters, columns, etc)?

Martins / eazyBI

1 Like

Dear Martins,
thanks for getting back to me and sorry for my late response. I have been away last week.
We are looking for how much time passes from issue creation (timestamp 1) until the issue is set to ‘In Progress’ (timestamp 2).
So we need these two timestamps to calculate the delta (elapsed time) for each ticket.
Actually we wanted to integrate this delta in a gadget in a Jira Dashboard. But I don´t know if this is possible?

Hi @Co225

Please check this community post:

It explains how issue cycles can be used.

Martins / eazyBI

1 Like

Dear Martin, first of all - thank you very much for your answer. Sorry for getting back so late to you - I have been away from the office.
To reply to your question:

We only need two dates to calculate:
First is the creation date of the issue. Second one ist the creation date of the very first comment in the issue. We need the delta between those two values.
This delta should be available in a form that we can integrate in a dashboard - or a separate report site, if this is easier.
The layout of the report would simply consist in 4 columns:
1:creation date issue - 2:creation date of first comment - 3:delta (result of substraction of those two) - 4: issuekey

also thanks for the information about issue circles you provided. Since we never worked with easy.BI however, I don´t know if we can manage that. Sounds quite complicated:-((

Best regards,
Co225

Hi, please check this page on how to import “last comment date” for each Issue
https://docs.eazybi.com/eazybi/data-import/data-from-jira/javascript-calculated-custom-fields/calculated-field-examples/latest-comment-date

With a slightly different Javascript code you can import “first comment date” (see here)

let comments = issue.fields.comment.comments;
if (comments.length > 0) {
  var comment = comments[0];
  issue.customfield_firstcom = comment.created;
}

when the “first comment date” field is imported with the checkbox property from the import options page > custom fields tab, you should find the measure “Issue first comment date” that returns the date of first comment.
Next, you could create a new calculated measure with the DateDiffDays function to return the delta between issue created date and date of first comment in days.
Finally, you could create one more calculated measure to return the Key for each issue.
Use this formula:

CASE WHEN
Not IsEmpty([Measures].[Issue created date])
THEN
[Issue].CurrenthierarchyMember.Key
END

Martins / eazyBI

1 Like

Dear Martins,
thanks so much for conveying the information. I´m really greatful that you spend so much time on this issue.
I will try this out.
Hopefully, this first issue will bring us closer to using eazy.BI which seems to be a very powerful tool.
Again, thank you for caring and helping us so much.

Kind regards
Co225