How do you use issueFunction with JqlClauseBuilder?

I'm trying to build a JQL query using the JqlClauseBuilder that calls the "issueFieldExactMatch" function provided by script runner. Just wondering how to call this function, because I can't seem to work it out?

This was my first attempt:

JqlClauseBuilder builder = JqlQueryBuilder.newClauseBuilder();

Query query = builder.project(projectId).and().issueType().in(VALID_ISSUETYPES as Long[]).and().not().issue(issue.getKey()).and().field("issueFunction").inFunc("issueFieldExactMatch", "", "summary", currentSummary).buildQuery()

but it seems to generate the following jql (note the missing empty string in the "subquery" argument):

project = "10000" AND issuetype  in (10400,10401,10402,10403) AND issueFunction in issueFieldExactMatch(, summary, "Test")

What it should generate is:

project = "10000" AND issuetype  in (10400,10401,10402,10403) AND issueFunction in issueFieldExactMatch("", summary, "Test")

I've tried various escape methods but none of them have worked. The closest I've come is "\\\"\\\"" which generates the following error:

com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: NoViableAltException(-1@[478:1: operator returns [Operator operator] : ( EQUALS | NOT_EQUALS | LIKE | NOT_LIKE | LT | GT | LTEQ | GTEQ | IN | IS NOT | IS | NOT IN | WAS | WAS NOT | WAS IN | WAS NOT IN | CHANGED );])

2 answers

Try passing com.atlassian.query.operand.EmptyOperand.OPERAND_NAME instead empty string.

0 vote

Hi Nathon,

did you try to add "\"\"" instead of "" ?

Long[]).and().not().issue(issue.getKey()).and().field("issueFunction").inFunc("issueFieldExactMatch", "\"\"", "summary", currentSummary).buildQuery()

Yeah originally I had "" and I've also tried "\"\"", "''" and various quantities of backslash characters. It's ok I'm using a work-around (use the standard .summary("foo") condition that generates a "contains" query, then loop through the results and try to find the exact match). Obviously not an efficient solution so would be good to find out how to make this work

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

165 views 1 10
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you