Hi,
I am trying to setup a listener using groovy-script-listener, it will listen to a custom field value. Setting the value to "yes" will trigger the "clone an issue and links" function.
It will clone the current issue wiith an inward link and set the issue type to "Doc Needed".
My question is how to check if there is an existing "Doc Needed" ticket linked to the affected ticket?
Any help will be apprieciated.
So far I have the following:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.link.IssueLink import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.component.ComponentAccessor def issueLinkManager = ComponentAccessor.getIssueLinkManager() def hasDocType = issueLinkManager.getInwardLinks(issue.id).any{it.destinationObject.issueTypeObject.name == "Doc Needed"} log.warn("####### hasDocType is :" + hasDocType + " &&&&& issue.key &&&&&: " + issue.key + " ##################")
Hey Sam,
Here is some Java code that might help.
Collection<IssueLink> links = issueLinkManager.getInwardLinks(issue.getId()); for(IssueLink link:links){ if(link.getSourceObject().getIssueTypeObject().getName().equals("Doc Needed")) //Do Something }
Hi Bhushan,
Cool, thank for the help. It works when I switched from destinationObject to sourceObject.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.