Forums

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

How to get "is child of" issue type

Andrii Striletskyi March 15, 2019

Hi team. How to get "is child of" linked issue? I've tried to do It , but can't get this issue. My Code:

for (link in issueLinkManager.getOutwardLinks(issue.getId())) {
log.error(link.getIssueLinkType().getName())
if (link.getIssueLinkType().getName() == "is child of") {
log.error("TEST")
etIssue = link.getDestinationObject()
if (etIssue.getResolutionObject() == null) {
result = true
}
else {
result = false
}
}
}

1 answer

1 accepted

0 votes
Answer accepted
Tarun Sapra
Community Champion
March 15, 2019

Hello @Andrii Striletskyi 

You are comparing the description of linkType (is child of) instead of the name. To find the name of the issue link go to the URL

<-Your-Jira-Base-URL>/secure/admin/ViewLinkTypes!default.jspa

Once you visit the above URL you can see the actual link name.

Andrii Striletskyi March 15, 2019

Yes , I known about this. I've set "Child" (is child of as inwards and outwards links) , but still can't get this issue (

Tarun Sapra
Community Champion
March 15, 2019

Can you share the screenshot of the issue links page in your jira instance and your exact code.

Andrii Striletskyi March 15, 2019

link.png

Andrii Striletskyi March 15, 2019

Code:

for (link in issueLinkManager.getOutwardLinks(issue.getId())) {
log.error(link.getIssueLinkType().getName())
if (link.getIssueLinkType().getName() == "Child") {
log.error("TEST")
etIssue = link.getDestinationObject()
if (etIssue.getResolutionObject() == null) {
result = true
}
else {
result = false
}
}
}

Tarun Sapra
Community Champion
March 15, 2019

What do you get for the log

log.error(link.getIssueLinkType().getName())
Andrii Striletskyi March 15, 2019

Nothing , empty string. Only Clones issues (there are 2 types - Cloners and is child of)

2019-03-15 07:54:10,373 ERROR [runner.ScriptRunnerImpl]: Cloners 2019-03-15 07:54:10,374 ERROR [runner.ScriptRunnerImpl]: There is no linked issues 2019-03-15 07:54:10,374 ERROR [runner.ScriptRunnerImpl]:

Andrii Striletskyi March 15, 2019

ET.png

Tarun Sapra
Community Champion
March 15, 2019
Tarun Sapra
Community Champion
March 15, 2019

It's to get all links irrespective of outward or inward. And then you add logging inside it

log.info()

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events