• Community
  • Products
  • Jira
  • Questions
  • When running a search inside a script runner script, no results are returned when an issuefunction in .... is used

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

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 vote

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

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 vote

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.

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}

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 Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

158 views 5 9
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