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,556,435
Community Members
 
Community Events
184
Community Groups

List Issues linked via another issue

Hi,

is there a way to use scriptrunner to give me a table with the correlation of 2 issues linked via a 3rd issue?

In practice I have:

issue1 -> link -> Issue2 -> link -> Issue3

I need a list of issues "issue1" and "issue3" in a table based on the links via issue2.

Is anyone had this need in the past?

Thanks so much!!

 

1 answer

0 votes
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 07, 2020

Hi Sergio,

Are you looking for a JQL to give you this result or rather a groovy script that gives you the issues in a list?

Hi Jeroen,

Thanks for your answer!

JQL would be perfect but I think a groovy script is the only one that can do the job.

So both solutions would work for me.

Thanks,

Sergio

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 15, 2020

Hi Sergio,

JQL I don't think it's possible,might be with Scriptrunner issuefunction, but not really sure. 

Any way, here is a code snippet to get all the linked issues of 1 issue (1 and 3 in your example. Starting from this, you should get something working:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.link.IssueLinkManager

IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager()
IssueManager issueManager = ComponentAccessor.getIssueManager()

Issue issue2 = issueManager.getIssueObject("ISSUE-2")
List<IssueLink> inwardLinks = issueLinkManager.getInwardLinks(issue2.getId())
List<IssueLink> outwardLinks = issueLinkManager.getOutwardLinks(issue2.getId())

List<Issue> linkedIssues = new ArrayList<>()

for (IssueLink link : inwardLinks) {
linkedIssues.add(issueManager.getIssueObject(link.getDestinationId()))
}

for (IssueLink link : outwardLinks) {
linkedIssues.add(issueManager.getIssueObject(link.getDestinationId()))
}

return linkedIssues 

 

Let me know if this was any help!

Regards,

Jeroen

Thanks Jeroen,

I was getting this point already but not able to sort out the correlation between the 2 issues linked to ISSUE2 and present them.

basically I am missing the logic able to populate the arrey based on this correlation but containing only issue1 name and issue3 name and rehiterate for all the issues with this correlation.

Any other idea from your side?

Thanks,

Sergio

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 22, 2020

Hi Sergio,

I can't quiet follow what you mean with "sorting out the correlations". Can you elaborate on what tour end result should look like?

 

Kind regards,

Jeroen

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events