0

I am developing application related to jira. I want count of issues return by the jql query. i got searchCount method in this link but i am not getting how to use this method using instance.

Kappa
  • 1,015
  • 1
  • 16
  • 31

1 Answers1

0

The setup should look like this:

    String jqlQuery = "project=ABC"; // insert your JQL query here

    SearchService.ParseResult parseResult = searchService.parseQuery(currentUser, jqlQuery);

    if (!parseResult.isValid())
    {
        // errors in parseResult.getErrors().getErrorMessages()
        throw new MyException();
    }

    com.atlassian.query.Query query = parseResult.getQuery();

    com.atlassian.jira.util.MessageSet validateResults = searchService.validateQuery(currentUser, query);

    if (validateResults.hasAnyErrors())
    {
        // errors in validateResults.getErrorMessages()
        throw new MyException();
    }

With the resulting validated query object, you can then call searchService.searchCount(currentUser, query) to get your issue count.

Scott Dudley
  • 3,256
  • 1
  • 18
  • 30