Hi,
I need to display last comment in customfield using Groovy Script.
Anyone done that?
Hello Jan:
In this question you will find an asnwer on how to get a comment from an Issue Object. Afterwards you can iterate to find the latest one, or find the one with the latest date.
If this doesn't work for you, let us know and I'll program a 1 on 1 meeting with you to get it working.
Cheers!
Put below code under custom "scripted field"
import com.atlassian.jira.ComponentManagerimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.comments.Commentimport com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.component.ComponentAccessor
def commentManager = ComponentAccessor.getCommentManager()
def comment = commentManager.getLastComment (issue)
comment.body
Thanks
Hi Tukaram,
is it possible to add user name who commented on this along with comment?.
Yes , use below code
comment.body + " Author: " + comment.authorFullName
Hi, Any idea if and how can I re-render the wiki style render ?
Lots of comments contain formatting and user mentions , new lines, bullets are not formatted at all.
Try this, it works but i found that my Database usage spiked after using it.
https://community.atlassian.com/t5/Jira-questions/Scripted-Field-to-copy-latest-comment/qaq-p/51850
Small update
Replace
import com.atlassian.jira.ComponentManager
with
import com.atlassian.jira.ComponentAccessor
import com.atlassian.jira.ComponentAccessorimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.comments.Commentimport com.atlassian.jira.issue.comments.CommentManager
Is it possible to have this script only show the last comment of the reporter or the assignee ?
can we get latest comment to the previous comment details.
Just want to see is there way to show the last comment without any inline images in the comment body? Thanks.
It looks like you're new here. Sign in or register to get started.