Last Internal comment

Hello guys!

Can anyone tell me if:

Is there any way to create a measure that lists the last Internal type comment?

I need to create a table that lists this information on how to measure.

Hi @Fabio.Santos,

It looks like you already have a JavaScript calculated custom field that looks for the last issue comment. eazyBI does not receive information if a comment is internal or visible to customers as well.
You may enhance the JavaScript code with the function getDocument to retrieve additional attributes for each comment and check if it is internal or external:
The code for JavaScript calculated custom field might look like this:

[jira.customfield_lastintcomment]
name = "Last Internal Comment"
data_type = "text"
javascript_code = '''
if (issue.fields.comment && issue.fields.comment.comments) {
  for (i=issue.fields.comment.comments.length-1; i>=0; i--) {
    var commentItem = issue.fields.comment.comments[i];
    var result = getDocument("comment/" + commentItem.id + "/properties/sd.public.comment",{ignoreErrors: [404]});
    if(result && result.value) {
      if(result.value.internal) {
        issue.fields.customfield_lastinternalcomment=commentItem.body;
        break;
      }
    }
  }
}
'''

In import options validate the JavaScript code Before applying changes to the Javascript code, double-check the customfield name “customfield_lastintcomment” to match your environment.
When you do the changes in advanced settings, make sure to re-import the custom field “Last Internal Comment”.
More details on how to validate and apply changes are here: JavaScript calculated custom fields.

Related topics on how to import comments:

Best,
Zane / support@eazyBI.com

1 Like

Hi @zane.baranovska This code doesn’t work for me, do you have any update?

@Marcelo_Ignacio_Cid1, please, follow the documentation on JavaScript calculated custom fields where to place them, and how to test them: JavaScript calculated custom fields.

Note that

Best,
Zane / support@eazyBI.com

thanks :smiley: @zane.baranovska

1 Like