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

Next challenges

Recent achievements


  • Give kudos
  • My kudos


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to look for the current issue while doing a JQL inside a groovy script?


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!

1 answer

1 accepted

0 votes
Answer accepted

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' && == 'Epic'
//do something to linkedEpic



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}')"

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

269 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you