Reporting on Comments by user both internal and external - Help!

Hi

I am trying to work out how to add custom fields for counting both Internal notes and Replies to external customers for a weekly assignee perfomance report
For example
Assignee: J.Bloggs
Number of Replies to customers: 8
Number of internal notes: 5

I dont need this to recalculate my data going backwards (concerned that this could timeout) but calculate going forwards the number by week

I have seen the below thread but it doesnt appear to split by internal and external and I am unsure if this is specific to the comment author or ticket (we want the author)

1 Like

Hello @THarman,

Thanks for posting your question!

You can count internal and external comments by using the following code in eazyBI advanced settings:

#this code counts internal comments
[jira.customfield_internalcomments]
name = "InternalComment"
data_type = "integer"
measure = true
javascript_code = '''
if(issue.fields.project.projectTypeKey == "service_desk"){
var commentcount = 0;
var commenta = new Array();
var allcomments = issue.fields.comment;
if (allcomments && allcomments.comments ) {
var comments = issue.fields.comment.comments;
for (var i = 0; i < comments.length; i++) {
var comment = comments[i];
if(!comment.jsdPublic){
commentcount++;
}
}
issue.fields.customfield_internalcomments = commentcount;
}
}
'''

#this code counts external comments
[jira.customfield_externalcomments]
name = "ExternalComment"
data_type = "integer"
measure = true
javascript_code = '''
if(issue.fields.project.projectTypeKey == "service_desk"){
var commentcount = 0;
var commenta = new Array();
var allcomments = issue.fields.comment;
if (allcomments && allcomments.comments ) {
var comments = issue.fields.comment.comments;
for (var i = 0; i < comments.length; i++) {
var comment = comments[i];
if(comment.jsdPublic){
commentcount++;
}
}
issue.fields.customfield_externalcomments = commentcount;
}
}
'''

:arrow_right: Please note that this would only work for Cloud instances.

After applying this code, you must select the “Internal Comment” and “External Comment” fields for the import. New measures and properties will be created, which can be used with other dimensions (e.g., Assignee, Time, and others).

I hope this helps!

Best,
Marita / support@eazybi.com