Hi All,
I am struggling with Issue Linking using groovy, I have an Inward Issue Links, So i need to capture that issue link and then using that issue link i need to perform some operations, like setting a status for that associated issue link.So any idea,I have written a piece of code. but its giving me the current issue ID and name.
def public OpenPositionFinalVersion(MutableIssue issue)
{
componentManager = ComponentManager.getInstance()
customFieldManager = componentManager.getCustomFieldManager()
issueFactory = componentManager.getIssueFactory()
issueManager =ComponentAccessor.getIssueManager()
jiraAuthenticationContext = componentManager.getJiraAuthenticationContext()
issueWorkflowManager = ComponentAccessor.getComponentOfType(IssueWorkflowManager.class);
issueFactory = ComponentManager.getInstance().getIssueFactory()
IssueLinkManager linkManager = ComponentManager.getInstance().getIssueLinkManager()
IssueLinkTypeManager issueLinkTypeManager = (IssueLinkTypeManager) ComponentManager.getComponentInstanceOfType(IssueLinkTypeManager.class)
IssueIndexManager issueIndexManager =ComponentAccessor.getIssueIndexManager()
workflowManager = ComponentAccessor.getWorkflowManager();
issueLinkTypeManager= ComponentManager.getInstance().getIssueLinkManager()
// This will log the error for this file
def Category log = Category.getInstance("com.onresolve.jira.groovy.OpenPositionFinalVersion");
log.warn("Current Issue is : " + issue)
List<IssueLink> allInIssueLink = linkManager.getInwardLinks(issue.getId());
for (Iterator<IssueLink> inIterator = allInIssueLink.iterator(); inIterator.hasNext();) {
IssueLink issueLink = (IssueLink) inIterator.next();
log.warn("Issue Link Type is : " +issueLink.getIssueLinkType().getId());
log.warn("Issue Link Name : " + issueLink.getIssueLinkType().getName())
Issue issue1= issueLink.getDestinationObject()
}
Collection<IssueLinkType> issueLinkTypes = ((IssueLinkTypeManager) ComponentManager
.getComponentInstanceOfType(IssueLinkTypeManager.class)).getIssueLinkTypes();
String linkID=null;
for (IssueLinkType linktype : issueLinkTypes) {
String name=linktype.getName();
if(name.equals("Open Position - Candidate Ticket")){
linkID=linktype.getId();
break;
}
}
}
OpenPositionFinalVersion(issue)