Last Internal comment

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