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 edited

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 edited

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
atlassian, confluence, marketing templates, confluence templates, marketing project management, content strategy, campaign planning, marketing collaboration, confluence for marketers, atlassian learning, marketing workflows, confluence best practices

5 must-use templates for Marketing teams (from a Confluence Marketer!) 👩🏻‍🎨

Who doesn’t love a good template? We sure do! Check out our top template picks for Marketing teams who want to streamline their processes, enhance collaboration, and take their marketing to new heights.

Read more 📚
AUG Leaders

Atlassian Community Events