• 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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,317 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot