Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Groovy script for seeing if issue is in JQL Query



I'm looking for a Jira groovy script that can check to see if the current issue belongs to a certain jql query. The idea is for it to return true or false. This is to be used as a workflow condition. Is someone able to help?

2 answers

1 vote

Scriptrunner is never going to have an entire JQL engine written into it to replicate what a JQL search already does.

The simple thing to do here is run the JQL and work with the results.  A search will return a pile of issues, and you can then look through the results to see if the issue or issues you are interested in are there.

A sample script is over at

0 votes

hi @Victor Graham ,

in JMWE, you can use this snippet:

!!jqlSearch( "key = ${issue.key} AND project = AM" , 1)

(where you can replace  project = AM with whatever JQL condition you need)

However, this is not always reliable in a Workflow Condition, as the Jira index that JQL searches uses might be lagging behind recent changes (because Jira updates its index asynchronously). It is preferable to use a Groovy condition script using JMWE's simplified API (such as issue.get())

Suggest an answer

Log in or Sign up to answer

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