Hello,
I am wondering if it's possible to run a query inside a groovy script, for the current issue for which the script is being executed (as a post function on a transition):
For regular JQL, we would use:
def jql = "project = ABC and issuetype = Epic"
But what we would need is:
Issue issue = issue
def issuekey = issue.getKey()
def jql = "project = ABC and issuetype = Epic and issueFunction in linkedIssuesOf('issuekey =" + issuekey+ "')'" //not working, of course
Would something like this be possible?
Thank you!
What's your ultimate goal?
If you can get the correct JQL, do you intend to run the query then examine the results all in code? (that's possible using the JqlQueryParser component)
If so, why not just access the linked issue via the JAVA API? That's what scriptrunner is for.
def issueLinkManager = ComponentAccessor.issueLinkManager
def links = issueLinkManager.getLinkCollection(issue, ComponentAccessor.jiraAuthenticationContext.loggedInUser)
links.allIssues.findAll{ linkedIssue->
linkedIssue.projectObject.key == 'ABC' && linkedIssue.issueType.name == 'Epic'
}.each{linkedEpic->
//do something to linkedEpic
}
Hi,
Yes, my goal here is to count how many related issues there are. I also considered going through the linked issues, but I was curious if it was possible to run a query for the current one. I eventually found:
Issue issue = issue
def currentfeaturerequest = issue.getKey()
def jql = "project = ABC and issuetype = Epic and issueFunction in linkedIssuesOf('issuekey = ${currentfeaturerequest}')"
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.