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

get a list of linked specific "Issue Types"?

A June 23, 2015

Currently i have got several examples of writing a scripted field to retrieve the linked issue data. i want to add a condition where script should validate 1) linktype and linked issue type.

ex: Ticket A has link to Ticket B (Task), C (Task) & D (Bug), ticket has link relates with B, D and blocks with C.

Now i am expecting my scripted field relates to retrieve 1, As it has bug as link issuetype.

currently i am using

import com.atlassian.jira.component.ComponentAccessor
 
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def issueLinks = issueLinkManager.getInwardLinks(issue.getId())
 
def subElements = issueLinks.findAll {    issueLinks*.issueLinkType.name.contains('Relates')}
 
return subElements.size() as Double

7 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Paresh Gandhi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2015
issueLinkManager.getInwardLinks(issue.id).each {issueLink ->    
    linkedIssue = issueLink.destinationObject 
    String issueType = linkedIssue.issueTypeObject.name
    if (issueType == "Bug"){
    //to do
    }
}

 

 

A July 2, 2015

Thanks Paresh, but above script does not verify the link type right??

A July 2, 2015

cuurently i am using this code import com.atlassian.jira.component.ComponentAccessor def issueLinkManager = ComponentAccessor.getIssueLinkManager() def issueLinks = issueLinkManager.getInwardLinks(issue.getId()) def subElements = issueLinks.findAll { issueLinks*.issueLinkType.name.contains('Relates')} return subElements.size() as Double This gives me data relating to number of links, but requirement is verify the linked issue type also

0 votes
amar June 23, 2015

i am new to scripted fields, if you can more detailed then it will be really helpful for understanding

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2015

Look at the destinationObject of each link and check the issuetype.

0 votes
amar June 23, 2015

"Relates" means, it is link based on the type of link. i have 10 tasks and 10 bugs linked to 1 story point all are using same relation. using above script i will get 20 as linked issues. i want 10 as answer. i want to count only linked bugs not tasks or vise verse

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2015

that's what this code does: issueLinks.findAll { issueLinks*.issueLinkType.name.contains('Relates')}

0 votes
A June 23, 2015

i want to retrieve, number of linked issues based on the specific issuetype

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2015

What's the question? You want to write a condition, but you posted code for a script field...? Confused.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events