Hi,
Trying to get this script to return link highlighted:
But can only get:
Confluence (5ee79c44-8e2a-3e22-bb7b-63268d5f5764) https://pmo.sure.com/confluence confluence
Sorry new to this scripting can someone help?
import com.atlassian.applinks.api.ApplicationLinkService
import com.atlassian.applinks.api.application.confluence.ConfluenceApplicationType
import com.atlassian.jira.bc.issue.link.RemoteIssueLinkService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.link.RemoteIssueLink
import com.atlassian.jira.user.ApplicationUser
import org.apache.log4j.Logger
import com.atlassian.jira.issue.link.RemoteIssueLinkStore
def applicationLinkService = ComponentAccessor.getComponent(ApplicationLinkService)
def remoteIssueLinkService = ComponentAccessor.getComponent(RemoteIssueLinkService)
def conf_link = applicationLinkService.getApplicationLinks(ConfluenceApplicationType)?.first()
return conf_link
Hey Kevin,
For remote links to an issue you have to make use of theRemoteIssueLinkManager. So for example if you want to get all the remote links (from your script console) for issue with key ATG-12 and print the application they are coming from, their title and their URL your script will look like
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.RemoteIssueLinkManager
def issue = ComponentAccessor.issueManager.getIssueByCurrentKey("ATG-12")
def remoteIssueLinkManager = ComponentAccessor.getComponent(RemoteIssueLinkManager)
def remoteLinks = remoteIssueLinkManager.getRemoteIssueLinksForIssue(issue)?.collect {"From Application ${it.applicationName}, Title ${it.title}, URL: ${it.url}"}?.join("<br>")
log.debug "Remote Links are $remoteLinks"
Hope that helps,
Thanos
Hey @Thanos Batagiannis _Adaptavist_ ,
Is it possible to set the variable remoteLinks above into a customfield through updateValue or setCustomField ?
Could you give me some help please ?
Thanks.
Cassio.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.