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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Displaying a list of issues with any of the same labels as current issue

So JIRA has a built in panel for displaying issue links: however these links need to be manually created.

I'd like to use ScriptRunner's Web Panel fragment to generate the exact same type of table except that its results are populated by any/all issues that have any/all of the current issue's labels.

How can I do this?

2 answers

0 votes
Steven Behnke Community Leader May 09, 2017
  1. You'd probably use a Script Fragment
  2. With your script, use the Label Manager to get all labels for the [issue] object in question
  3. For these labels, you should probably execute a query to find all issues with said labels
  4. When you're returned a list of issues, you can render these in a table

OK, I think I have the basic starting point out, but I need to know how to:

1) Search for issues

2) Iterate through the results

 

import com.atlassian.jira.issue.Issue

def issue = context.issue as Issue

def key = issue.key
def summary = issue.summary
def labels = issue.getLabels()*.label

writer.write("<table class='aui'>" +
    "<thead>" +
        "<tr>" +
        "<th>Key</th>" +
        "<th>Summary</th>" +
        "<th>Labels</th>" +
        "</tr>" +
    "</thead>" +
    "<tbody>" +
        "<tr>" +
            "<td>" + key + "</td>" +
            "<td>" + summary + "</td>" +
            "<td>" + labels + "</td>" +
        "</tr>" +
    "</tbody>" +
"</table>")
0 votes

i know it is an old topic, but did you manage to solve it? if so can you help me out pls, i wanna get all issues with same labels and count them.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

🤺 Atlympic Event: Partnerships

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

149 views 2 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you