Example scripts
To homepage
Confluence

Get Outgoing Links CQL function
App in script

ScriptRunner For Confluence
by Adaptavist
Compatibility

Confluence (7.15 - 8.6)

ScriptRunner For Confluence (7.10.0)
Language |
groovy
package examples
import com.atlassian.confluence.links.OutgoingLink
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.spaces.Space
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.sal.api.component.ComponentLocator
String spaceKey = params[0]
String pageTitle = params[1]
SpaceManager spaceManager = ComponentLocator.getComponent(SpaceManager)
PageManager pageManager = ComponentLocator.getComponent(PageManager)
def ids = []
Space space = spaceManager.getSpace(spaceKey)
for (Page page : pageManager.getPages(space, true)) {
for (OutgoingLink link : page.getOutgoingLinks()) {
if (link.getDestinationPageTitle().equals(pageTitle) && link.getDestinationSpaceKey().equals(spaceKey)) { // <4>
ids << String.valueOf(page.getId())
}
}
}
ids
Having an issue with this script?
Report it here