---
title: "Last comment from role scripted field"
canonical: "https://support.appfire.com/space/PSJC/854327408/Last%20comment%20from%20role%20scripted%20field"
format: markdown
---
> Macro (aura-html)


## 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;
```