Skip to main content
Example scripts
arrow icon
To homepage
Confluence
Data centre icon
Data Center

Add a Comment on a Page

Created 1 year ago, Updated 3 month(s) ago
App in script
ScriptRunner For Confluence
ScriptRunner For Confluence
by Adaptavist
Compatibility
compatibility bullet
Confluence (7.15 - 8.6)
compatibility bullet
ScriptRunner For Confluence (7.10.0)
Language |
groovy
import com.atlassian.confluence.pages.CommentManager
import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator

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

def pageTitle = '<YOUR_PAGE_TITLE>'
def spaceKey = '<YOUR_SPACE_KEY>'

def page = pageManager.getPage(spaceKey, pageTitle)

commentManager.addCommentToObject(page, null, 'This is a comment')
Having an issue with this script?
Report it here