Hello
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?
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())
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 https://library.adaptavist.com/entity/perform-a-jql-search-in-scriptrunner-for-jira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.