Forums

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

How to get Issue links of a sub-task?

Andrew L
Contributor
April 25, 2018

Hi,

I have the following "Custom script post-function" Groovy code


def issueLinkManager = ComponentAccessor.getIssueLinkManager()
List<IssueLink> innerLinks = issueLinkManager.getInwardLinks(issue.getId())
List<IssueLink> outerLinks = issueLinkManager.getOutwardLinks(issue.getId())

for(issueLink in innerLinks){
    def linkTypeName = issueLink.getIssueLinkType().getName()
    log.debug(String.format("innerlink: current issuelink type name is %s", linkTypeName))    
}

for(issueLink in outerLinks){
    def linkTypeName = issueLink.getIssueLinkType().getName()
    log.debug(String.format("outerlink: current issuelink type name is %s", linkTypeName))
}

I have an issue PRJ-123 that has Type = "Sub-task". 

I click on "Resolve Issue" and I specify:

"Duplicate" for the "Resolution" field

"duplicates" for the "Linked Issues" field

and PRJ-987 for the "Issue" field.

In the logfiles, i see :

innerlink: current issuelink type name is jira_subtask_link

I was expecting to see "Duplicate" instead of "jira_subtask_link" :

outerlink: current issuelink type name is Duplicate

For another issue that is of Type = "Bug", i see the issuelink as "Duplicate".

So how can i find the "Duplicate" issuelinks of an issue that has Type = "Sub-task" ?

 

Thanks

--Andrew

2 answers

0 votes
Alexey Matveev
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.
April 25, 2018

Hello, when you add a link it does not mean that you delete the old link. And if you see only the subtask link, it means that you script works before the link was created.

0 votes
Tarun Sapra
Community Champion
April 25, 2018

Hello @Andrew L

Is Duplicate an bi-directional link? Because I think it's working fine because for the innerLink on the sub-task you see the dedfault "jira_subtask_link" which exists between the existing sub-task and its parent and the "duplicate" link which you have set can be a uni-directional outer link from the sub-task to the issue key which you have mentioned.

Andrew L
Contributor
May 15, 2018

Thanks for the reply.

I think "duplicates" is an outward link and "is duplicated by" is an inward link.

It turns out my requirements have changed and i no longer need to loop through the issue links.

--Andrew

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events