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

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