How filter issues by worklogAuthor using the jqlClauseBuilder in the Jira SDK

Lisanne Nauta August 3, 2018

I'm building a custom report with the JIRA SDK. However, I have difficulties to build a query using the worklogAuthor. I would like to do something like:

 

Query q = jqlClauseBuilder.addStringCondition("worklogAuthor",Operator.EQUALS,"admin").buildQuery();

But it throws an error. Can someone help me?

2 answers

0 votes
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2018

Hello @Lisanne Nauta

Do you really need to use jqlClauseBuilder? 

Try to use jqlParser instead

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter


def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

// jql query to sum fields
def query = jqlQueryParser.parseQuery("worklogAuthor = admin")
//get results
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())
0 votes
Lisanne Nauta August 3, 2018

This seems to work properly. But the query  jqlClauseBuilder.addStringCondition("worklogAuthor","admin").buildQuery(); failed. Should also be posible.

Suggest an answer

Log in or Sign up to answer