Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence resolve open inline comments on a page [Scriptrunner]

Roman Kersky
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2021

Hi, everyone.

Tell me pls. Why my script not changed the status of inline comments?

 

import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.pages.Comment
import com.atlassian.confluence.pages.CommentManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.pages.CommentStatus

def pageManager = ComponentLocator.getComponent(PageManager)
def commentManager = ComponentLocator.getComponent(CommentManager)

def page = pageManager.getPage(582392168L)

def comments = commentManager.getPageComments(page.id,new Date(0))

comments = comments.findAll{comment->!comment.isDeleted()&&comment.isInlineComment()&&comment.status.isOpen()&& !comment.getParent()}

def statusBuild = new CommentStatus.Builder()
statusBuild.setValue(CommentStatus.Value.RESOLVED)

comments.each{c->
c.setStatus(statusBuild.build())
}

return 1

 

1 answer

1 accepted

1 vote
Answer accepted
Alexey Ershov June 7, 2021

To update comment try to use:
commentManager.updateCommentContent(comment, comment.bodyAsString)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events