Hello,
i need to get all linked issues of an issue.
This works fine with any link type, but not with the "Epic-Story Link"-Type.
This is my code:
String linkName = "01 Verfeinerung"; java.util.List<Issue> next_level = null; IssueLinkManager lm = ComponentManager.getInstance().getIssueLinkManager(); ServletValueStack valStack = (ServletValueStack)request.getAttribute("webwork.result"); ViewIssue vi = null; for (java.util.Iterator i = valStack.iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof ViewIssue) { vi = (ViewIssue) o; LinkCollection lc = lm .getLinkCollectionOverrideSecurity(vi.getIssueObject()); next_level = lc.getOutwardIssues(linkName); if (next_level == null) { next_level = lc.getOutwardIssues(epicLinkName); } break; } }
If the linkName is a "normal" link, all works fine, but if i insert "Epic-Story Link", it does not work.
I checked the database, there is an entry called "Epic-Story Link".
Community moderators have prevented the ability to post new answers.
Solution:
Get the Epic through the value of the field "Epic-Link" in the Story.
CustomFieldManager cfm = ComponentAccessor.getCustomFieldManager(); IssueManager im = ComponentAccessor.getIssueManager(); CustomField cf = cfm.getCustomFieldObject(new Long(14122)); // Get current story issue Issue storyIssue = im.getIssueObject(vi.getId()); // Get epic id from epic link field Issue epicIssue = (Issue) cf.getValue(storyIssue); // Get epic issue with epic id if(epicIssue != null) { next_level = new ArrayList(); next_level.add(epicIssue); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.