Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,210
Community Members
 
Community Events
184
Community Groups

Script does not return remote link

Hi,

Trying to get this script to return link highlighted:

Conf link.JPG

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

1 answer

1 vote
Thanos Batagiannis [Adaptavist]
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.
Dec 05, 2017

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events