How can I delete a specific comment from an issue based on the comment id with Scriptrunner? Example: Delete from Issue 10 Comment 223
Hi,
this thread should help you
https://community.atlassian.com/t5/Jira-questions/How-to-delete-user-comment/qaq-p/979266
Thank you for your tip
here is the code that is actually working for me; could be better but does the job:
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.IssueManagerimport com.atlassian.jira.issue.MutableIssueimport com.atlassian.jira.issue.comments.Commentimport com.atlassian.jira.issue.comments.CommentManagerString issueKey = "AB-1234"Integer commentID = 1234567IssueManager issueManager = ComponentAccessor.issueManagerCommentManager commentManager = ComponentAccessor.commentManagerMutableIssue issue = issueManager.getIssueObject(issueKey)List<Comment> comments = commentManager.getComments(issue)comments.each {comment -> if (comment.id == commentID) { commentManager.delete(comment) }}
It looks like you're new here. Sign in or register to get started.