Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Count of Linked issues in a custom field with respect to Link Type

Holan Shetlar August 10, 2017

Looking for a way to count of Linked issues in a custom field with respect to Link Type

2 answers

1 accepted

1 vote
Answer accepted
Tarun Sapra
Community Champion
August 10, 2017

Without using plugins you can't do this in JIRA. You need scripted fields from the script runner plugin.

Some samples - https://scriptrunner.adaptavist.com/5.0.4/jira/scripted-fields.html 

At runtime when the screen loads you can calculate the linkedissues based on link type and show their count in the custom field.

1 vote
Barb O'Connell
Contributor
September 21, 2018 edited

I have not been able to find a way to do this using the documentation.  I did find this code and would like help altering it to specify a Link Type instead of an Issue Type:

import com.atlassian.jira.component.ComponentAccessor

 

int x = 0

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def linkedIssues = ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, currentUser).getAllIssues()

if (linkedIssues.size() > 0){

  for (int i = 0; i < linkedIssues.size(); i++){

    if (linkedIssues[i].getIssueType().getName() == "Bug"){

      x = x + 1

    }

  }



if (x > 0){

  return x

}else return null

 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery learning path, product discovery training, idea prioritization, align stakeholders, discovery to delivery, product collaboration, atlassian learning, dev process, roadmap planning, insight capture, team alignment

Elevate Your Skills with Jira Product Discovery!

Unlock your potential and learn how to use Jira Product Discovery to your advantage. You’ll have the expertise to revolutionize ideas and insights, roadmapping, engage and align teams and stakeholders, and deliver the best solutions—faster. Enroll today!

Start Learning
AUG Leaders

Atlassian Community Events