When running a search inside a script runner script, no results are returned when an issuefunction in .... is used

francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 15, 2014

As in summary, we have a script which takes a JQL string as input and outputs the list of issues matching the JQL.  When we use the 'issuefunction in' jql function, no results are returned.  

 

What could be a potential root cause

4 answers

0 votes
francis
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 16, 2014

The script calls an utility function - returning a list of issues. (Not sure what the new answers will do with the next piece of code) When we run another query like 'project = MRM and resolution is empty', the query runs fine. {code} class SearchUtil { private static Logger log = Logger.getLogger(SearchUtil.class); private static SearchService searchService = ComponentAccessor.getComponent(SearchService.class); /* * Search issues based on the JQL query string. * Return an empty list if no results - or an error when processing the query */ public static List<Issue> doQuery(User adminUser, String queryString) { ParseResult parseResult = searchService.parseQuery(adminUser, queryString); if (parseResult.isValid()) { try { SearchResults results = searchService.search(adminUser,parseResult.getQuery(), PagerFilter.getUnlimitedFilter()); if (results != null) { log.debug("Found ${results.getTotal()} results"); return results.getIssues(); } log.debug("Found null results"); } catch (SearchException e) { log.error("Error running search", e); } } else { log.warn("Error parsing jqlQuery: " + parseResult.getErrors()); } return []; } } {code}

0 votes
JamieA
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 16, 2014

OK, I don't see why that would not work. Certainly works in the latest version. I need the script to reproduce, maybe you are trying to run as anonymous or something.

0 votes
BenP
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 16, 2014

Hi Jamie, * JIRA v6.1.3#6158-sha1:b5b5eab / Script Runner Version: 2.1.16 * no log output * sample involved function: {noformat}issueFunction in issueFieldExactMatch("project = MRM and type = Requirement", "Mrmref", "^170"){noformat} Mrmref is a custom field (Text) @Francis Martens (iDalko) will be able to provide more details (script, ..) later

0 votes
JamieA
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 15, 2014

Any log output? What versions? Can you create a small script that exhibits the problem to share?

Suggest an answer

Log in or Sign up to answer