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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to get list of Linked issues which are "is blocked by" current and ranked higher in backlog? Edited

Hi Team,
I want to check my backlog through the scripted field looks like default field on scrum board "Linked issues". But I need to enumerate only those ones that are linked to current by "is blocked by" link and ranked higher in backlog and not in statuses Done or Won't fix.
Thanks for help.
2018-04-19_08-50-08.png

3 answers

1 accepted

Solved! :)

import com.atlassian.jira.component.ComponentAccessor

//Get necessary managers
def cfm = ComponentAccessor.customFieldManager
def linkManager = ComponentAccessor.issueLinkManager

def rank = cfm.getCustomFieldObjectByName("Rank")
def issueRankValue = (String) issue.getCustomFieldValue(rank)
def issueProject = issue.getProjectId()

def issueKeys = []
//Go through all linked issues and collect their keys
linkManager.getOutwardLinks(issue.id).each{
def linkedIssue = it.destinationObject
def linkedIssueProject = linkedIssue.getProjectId()
def linkType = it.getIssueLinkType()
def linkedIssueRankValue = (String) linkedIssue.getCustomFieldValue(rank)
def linkedIssueStatus = linkedIssue.getStatus()
def linkedIssueStatusName = linkedIssueStatus.getName()

if( issueProject == linkedIssueProject &&
linkType.getInward() == "is blocked by" &&
issueRankValue > linkedIssueRankValue &&
!(linkedIssueStatusName in ["Done", "Won't fix", "Not Reproduced"]) )
{
issueKeys.add("${linkedIssue.key}")
}
}

if(issueKeys.size() > 0)
{
return issueKeys.join(', ')
}
else
{
return null
}

It looks like frequently used functionality. But I didn't find answer during several days.
Any other ideas? - add-ons, gadgets?

We have this issue, where we're using one epic to demarcate between the ones we care about and the stuff that's "below the line" (e.g. still being refined) and all of the epics are ordered by rank.

This answer doesn't give us a dynamic way to achieve this, but if your magic ticket is fixed, then it should do the job. Let's assume this magic epic is "MG-123". If search in Jira, any search, then replace the JQL with "key = MG-123", then you should get a table of results with one result in it. Add a column to display the "rank" field. You'll get the crazy rank text.

Now, in the JQL search you actually wanted in the first place, your JQL needs to include "rank < 'gibberish'" to only show the stuff above the line or > for the stuff below the line. Something like that.

Apologies - I was led here from How-I-can-I-use-JQL-to-show-all-issues-with-a-rank-higher-than-a-particular-issue and didn't spot the question is different, so my answer is for that question (which has been closed without answer after seven years - thanks Atlassian!)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,184 views 8 28
Join discussion

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