Hi , I am trying to write script field which will get page name and page url of the confluence page which is linked to an issue (RemoteIssueLinks). Can you please help me on how to find it through script runner - groovy code.
I have tried tried remote link service. But, There are no methods to get the URL and page name. I am able to get only pageId.
Here is my code,
def hasAnyRemoteConfluenceLink(ApplicationUser user, Issue issue, Logger log = null) {
def applicationLinkService = ComponentAccessor.getComponent(ApplicationLinkService)
def remoteIssueLinkService = ComponentAccessor.getComponent(RemoteIssueLinkService)
def conf_link = applicationLinkService.getApplicationLinks(ConfluenceApplicationType)?.first()
if (!conf_link) {
log?.error "No confluence application link found."
return false
}
//return remoteIssueLinkService.getRemoteIssueLinksForIssue(user, issue)?.remoteIssueLinks?.any{it.applicationType == RemoteIssueLink.APPLICATION_TYPE_CONFLUENCE}
def x = []
if(remoteIssueLinkService.getRemoteIssueLinksForIssue(user, issue)?.remoteIssueLinks?.any{it.applicationType == RemoteIssueLink.APPLICATION_TYPE_CONFLUENCE}) {
remoteIssueLinkService.getRemoteIssueLinksForIssue(user, issue)?.remoteIssueLinks?.any{
x.push(it.getApplicationName())
x.push(it.getApplicationType())
x.push(it.getGlobalId())
x.push(it.getIconTitle())
x.push(it.getIconUrl())
x.push(it.getId())
}
}
}