• 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

This widget could not be displayed.

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

This widget could not be displayed.

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

This widget could not be displayed.

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.

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

564 views 25 15
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