Skip to end of banner
Go to start of banner

Last comment from role scripted field

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Problem

You want to show the last comment made by a specific role on an issue as a custom field so that it will display in the issue results list or on an issue sidebar. This role could be for a customer support agent, or a developer for example.

Solution

string lastDeveloperComment = "There have been no comments left by a developer for this issue";

for(integer comm in getAllCommentIds(key)) {
   JComment c = getCommentById(key, comm);
   if(isUserInRole(c.author, project, "Developers")) {
       lastDeveloperComment = c.text;
   }
}
return lastDeveloperComment;
  • No labels