Hi Community,
we would like to change our current custom field which shows the date of the last public comment to the customer. We upgraded our JIRA instance, with this the comment restrictions got removed for service desk projects and our script now shows the date and time of the last comment by us whether it's internal or not.
This is the script we used before upgrade:
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.security.groups.GroupManager
import com.atlassian.jira.component.ComponentAccessor
import java.util.Comparator;
def commentManager = ComponentAccessor.getCommentManager()
def groupManager = ComponentAccessor.getGroupManager()
def commentList = commentManager.getComments(issue).sort{it.getCreated()}
Collections.reverse(commentList)
for (Comment comment : commentList) {
if (comment.getRoleLevelId() == null &&
comment.getGroupLevel() == null &&
groupManager.isUserInGroup(comment.getAuthorApplicationUser(), 'service-desk-agents')) {
return comment.getCreated()
}
}
return null
How can we change it so that only the date & time of the last comment shared with the customer is shown?
Thanks for the help :)
Hi Ravi,
yes exactly, we want to display the date/time of the last comment which was shared with the customer. I'll take a look at the script you sent and try it out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.