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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,993
Community Members
 
Community Events
176
Community Groups

ComponentAccessor.getIssueLinkManager does not return correct counts

Edited

Dear all,

I have a wierd issue in by getting the list of related linked to issue.

If I create an issue with 2 relates to linked issue, the following code returns correctly the 2 related issue using

def links =ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId())

return links.size() => return 2 = OK

If then I add a new relates to issue to same parent issue and run the code again,  it is still returning 2 instead of 3.

Any idea what is wrong ?

 

Here is my all custom scripted field code

=>

import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

if (issue.issueType.name == "Service Request") {

def links = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId())

//def links = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())


def BudgetField =customFieldManager.getCustomFieldObjects().findByName("Budget Number")
def CurrencyField =customFieldManager.getCustomFieldObjects().findByName("Currency")
def CurencyValue=issue.getCustomFieldValue(CurrencyField)

//return links[0].getSourceObject()


double Budget=0
for( l in links) {

//use this for Outward links
// output = output + l.getSourceObject().issueType.name + "<br/>"
if (l.getSourceObject().getCustomFieldValue(BudgetField) != null){
double val= l.getSourceObject().getCustomFieldValue(BudgetField)

Budget=Budget + val

}
//use this for Inward links
// output = output + l.issueLinkType.name + ": " + l.getSourceObject() + "<br/>"

}

return (Budget + " $CurencyValue")
}

<==

regards

 

 

1 answer

1 accepted

0 votes
Answer accepted

I found out the reason.

The problem was comming from the fact that Jira gets by default same value for InWard and Outward link for Relates entry, which is quite non sense as direction is really important

Regards

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events