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

How to get key and issue type from linked issue?

NewByatl
Contributor
July 12, 2021

I'm writing script (behaviour) which doing next : If current issue (for example A-1 has linked issue with key CRSUB and issueType Story. Then customField "Def on prod" become avaliable for certain group in project. How i can do it? I have some dificults in writing this script.

 

import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.link.IssueLink;

IssueManager im = ComponentAccessor.getIssueManager();
MutableIssue issue = im.getIssueObject("CR-177")


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


def output = ""
for( l in links) {

output = output + l.getDestinationObject() + "<br/>"

if (output.contains("CRSUB") ){
log.warn("test")
}

}

return output

// How to get current issue and issueType of linked issue? Im stuckimage-2021-07-12-15-48-41-176.png

1 answer

0 votes
Nic Brough -Adaptavist-
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 12, 2021

The iterative object here should be an issue in its own right, so l.getKey() would be a starting point.  You can probably see how to get the rest of the issue information.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, ace, atlassian community event, donation, girls who code, women in tech, malala fund, plan international, kudos, community badge, badge, atlassian badge, International Women’s month, International Women’s Day, women's month, women's day

10 for Change at Atlassian Community Events

Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!

Join an Atlassian Community Event!
AUG Leaders

Upcoming Jira Events