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?

1 answer

0 vote
Steven Behnke Community Champion 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>")

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

119 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you