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

**URL:** <https://community.eazybi.com/t/reporting-on-comments-by-user-both-internal-and-external-help/17592>\
**Category:** Questions & Answers\
**Created:** [June 28, 2024, 10:30am UTC](https://community.eazybi.com/t/reporting-on-comments-by-user-both-internal-and-external-help/17592 "2024-06-28T10:30:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![THarman](https://community.eazybi.com/letter_avatar_proxy/v4/letter/t/58f4c7/32.png) [@THarman](https://community.eazybi.com/u/THarman)\
**Post date:** [June 28, 2024, 10:30am UTC](https://community.eazybi.com/t/reporting-on-comments-by-user-both-internal-and-external-help/17592/1 "2024-06-28T10:30:32Z")

</div>

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)

> [@Calculating the number of comments - by specific USER](https://community.eazybi.com/t/calculating-the-number-of-comments-by-specific-user/1788/2):
>
> Hi @chrischarles2002, In the mentioned community post [Calculating the number of comments](https://community.eazybi.com/t/calculating-the-number-of-comments/255/2) , is an example of how to import comment count using [JavaScript calculated custom fields](https://docs.eazybi.com/eazybijira/data-import/custom-fields/javascript-calculated-custom-fields). To count comments by each author, you may modify JavaScript code. To do this, declare that each issue might have a set (array) of user names who have commented on it and comment count accordingly. To represent names of comment authors in eazyBI, you may use some existing dimension which contains user names, like, Assi…

---

<div class="post-metadata">

**Author:** ![Marita\_Burgio](https://community.eazybi.com/user_avatar/community.eazybi.com/marita_burgio/32/11216_2.png) [@Marita\_Burgio](https://community.eazybi.com/u/Marita_Burgio)\
**Post date:** [July 10, 2024, 3:19pm UTC](https://community.eazybi.com/t/reporting-on-comments-by-user-both-internal-and-external-help/17592/2 "2024-07-10T15:19:22Z")

</div>

Hello @THarman,

Thanks for posting your question!

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

```auto
#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) { //if filtering by internal_note
//if(comment.author.accountType == "atlassian"){ //if filtering by agent
commentcount++;
}
}
return 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.author.accountType == "customer"){ //if filtering by author which is customer
//if(comment.jsdPublic){ //if filtering by internal_note 
commentcount++;
}
}
return commentcount;
}
}
'''

```

➡ 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](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![Teodor\_Hoza](https://community.eazybi.com/user_avatar/community.eazybi.com/teodor_hoza/32/11410_2.png) [@Teodor\_Hoza](https://community.eazybi.com/u/Teodor_Hoza)\
**Post date:** [March 25, 2025, 3:26pm UTC](https://community.eazybi.com/t/reporting-on-comments-by-user-both-internal-and-external-help/17592/3 "2025-03-25T15:26:21Z")

</div>

I have a question here, while this code can measure internal and external comments, can this be used together with a custom dimension that serves the purpose of gathering the users that commented on tickets, let’s say like Worklog Author, I am trying to make a custom dimension that filters Comment Authors (agents).

---

<div class="post-metadata">

**Author:** ![Marita\_Burgio](https://community.eazybi.com/user_avatar/community.eazybi.com/marita_burgio/32/11216_2.png) [@Marita\_Burgio](https://community.eazybi.com/u/Marita_Burgio)\
**Post date:** [March 26, 2025, 2:21pm UTC](https://community.eazybi.com/t/reporting-on-comments-by-user-both-internal-and-external-help/17592/4 "2025-03-26T14:21:25Z")

</div>

Hi @Teodor_Hoza,

Yes, it’s possible. My colleague Ilze is answering a similar question in this community post: [How many different people have commented in tickets of a project](https://community.eazybi.com/t/how-many-different-people-have-commented-in-tickets-of-a-project/17320)

Best,  
Marita // [support@eazybi.com](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![martins.vanags](https://community.eazybi.com/user_avatar/community.eazybi.com/martins.vanags/32/8905_2.png) [@martins.vanags](https://community.eazybi.com/u/martins.vanags)\
**Post date:** [April 4, 2025, 1:07pm UTC](https://community.eazybi.com/t/reporting-on-comments-by-user-both-internal-and-external-help/17592/5 "2025-04-04T13:07:31Z")

</div>

Hi all’

Here is an example on how to import last external comment date in eazyBI for each Jira issue:

> **[Latest external comment date](https://docs.eazybi.com/eazybi/data-import/data-from-jira/javascript-calculated-custom-fields/calculated-field-examples/latest-external-comment-date)**

Martins / eazyBI support
