Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

issueLinkManager.getOutwardLinks do not find all links

Hi, 

 

We have scriptrunner for Jira in use and I have script which should check all linked issues to Initiatives. 

Currently I use for logging : 

issueLinkManager.getOutwardLinks(issue.id).each { issueLink ->;
Issue linkedIssue = issueLink.destinationObject

log.info( "****************getOutwardLinks************** ! ")
log.info( "**** linkedIssue : " +linkedIssue)
log.info( "**** issueLink.issueLinkType.name : " +issueLink.issueLinkType?.name)
log.info( "**** linkedIssue.resolution.name : " +linkedIssue.resolution?.name)
log.info( "****************************** ! ")

if (issueLink.issueLinkType?.name == "Parent-Child Link") {......

 

by some reason this does not find links for all issues. 

New initiative + new linked epic this works ok

Old initiative + new linked epic founds new linked epic not old ones in same initiative. 

Old initiative + old linked epic not work.

 

 

3 answers

I have the very same problem.  Some children of portfolio level issues will not be returned when executing something like this in a groovy script:

def links = issueLinkManager.getOutwardLinks(issue.id)
links.findAll

-or-  linkedIssues.findAll

Our hierarchy goes:

Initiative --> Capability --> Feature --> Epic --> Story

Here's an example of what happens.  A Capability has 11 child Features.  Running a JQL query like "Parent Link" = ABC-123 (where ABC-123 is the key of the Capability) will return all 11 of them.  We have Scriptrunner and a JQL query like: issuefunction in PortfolioChildrenOf("issue = ABC-123") will also correctly return all 11 child Features.

BUT the groovy script will only find 8 of them, not 11.  If I edit the missing issues and remove the Parent Link value and then put it back again and Submit, then the groovy script will see the Feature.  That is, the 'findAll' links statement will now return the Feature in which I just edited the Parent Link field along with the other 8.

If I do a Bulk Edit (Issue Navigator --> Tools --> Bulk Change) of the remaining two missing Features and edit the Parent Link field that way, they still DO NOT get returned by the findAll links statement in the groovy script.  The only way to fix this is by manually editing the Parent Link field.  Thus, my guess is that this has to do with some kind of indexing issue(?).

Completely deleting and rebuilding the indexes with a foreground reindexing will not resolve this.

I'm at a loss as to how these seem to randomly get 'corrupted'.  They seem to get created that way.  Once the Parent Link field is manually edited to resolve the problem, they will never develop this problem again and things will work as expected for that issue ever after.  I can find no pattern whatsoever regarding how they are created in this corrupt state (wherever the 'corruption' may actually be).  Cloned, or not cloned, created through the gui or via the API, etc., created via importing from a CSV file.  By any of those means, there just seem to be some random issues in which the 'Parent Link' come out wonky (despite all appearences) and they will not found by looking for the link in a groovy script.  And the only way I can find to 'fix' them is to manually edit the Parent Link field, removing and reentering the parent value. 

This may randomly happen to any issue with a Parent Link field (meaning Epics and above in our case).

HAS ANYONE FIGURED OUT WHY THIS IS HAPPENING?  HOW TO PREVENT IT?  OR EVEN AN AUTOMATED MEANS TO FIX IT???  Manually running groovy scripts and comparing the result set to the results of a JQL query to discover which are missing from the groovy script and then manually editing every one of them (there may be hundreds), one at a time... well... it really sucks.

@David Fischer _Appfire_ 

I can confirm we have the same issue, luckily it is only the pre-production instance, so I'm not so much worried to fix it.

hello,

i have the same kind of problem in a scriptunner script i'm testing in the console:

An initiative (transverse purpose Initiative for maintenance activities) has 326 child Epics:

- i can list the 326 Epics in the Child issues section of the Initiative ticket

- i can list the 326 Epics using the JQL query "Parent Link" = key of my Initiative ticket

- But i get only 181 Epics (all as outward links)  when listing them using the following scriptunner groovy script in the console:

issueLinkManager.getOutwardLinks(issue.id).each { IssueLink linkedInitiativeChildIssue ->
log.info("OUTLINK FOUND: "+linkedInitiativeChildIssue.getDestinationObject().getKey()+" ISSUE TYPE: "+linkedInitiativeChildIssue.getDestinationObject().getIssueType().getName())
}

issueLinkManager.getInwardLinks(issue.id).each { IssueLink linkedInInitiativeChildIssue ->
log.info("INLINK FOUND: "+linkedInInitiativeChildIssue.getSourceObject().getKey()+" ISSUE TYPE: "+linkedInInitiativeChildIssue.getSourceObject().getIssueType().getName())
}

 

Furthermore:

After identification of a missing Epic, if i display the missing Epic ticket, then edit the field "Parent Link" and validates it without changing its vakue, then this Epic will appear if i execute again the groovy script !

 

Would anyone has an idea of the cause of this, and how to remedy ?

 

Thanks a lot :)

Laurent

I'm not sure that's the case, but are you sure you are using the right way links? Each issue link has a source and destination (from which and to what issue it goes), so by getting only issue's outward links you are getting only those ones where you issue is the source.

So maybe links you are missing are inward ones? It sometimes get's messy when you name both directions similar.

Hi, 

 

Can initiative - epic link be build in wrong way as it is parent - child type, similar like epic- task ? 

I guess if it's "issue in epic" type of link then probably no, if it's regular link then yes.

In this case issue in epic and parent linking for initiatives, so structural linking in this case. 

In case of regular (relates, blocked by .. ) linking is different story. 

Suggest an answer

Log in or Sign up to answer
TAGS

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