In Jira Cloud, have the JMCF app by AppFire and trying to create a scripted field to display the last comment body, date and author. When I test, I recieve this error:
TypeError: Cannot read property 'comments' of undefined in script at line 2, column 37
// Get the comments from the issue
var comments = issue.fields.comment.comments;
if (comments && comments.length > 0) {
// Get the last comment
var lastComment = comments[comments.length - 1];
// Extract the details
var lastCommentBody = lastComment.body;
var lastCommentDate = lastComment.created;
var lastCommentAuthor = lastComment.author.displayName;
// Format the output
var result = "Last Comment: " + lastCommentBody + "\n" +
"Last Comment Date: " + lastCommentDate + "\n" +
"Last Comment Author: " + lastCommentAuthor;
// Return the result
return result;
} else {
return "No comments available.";
}
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.