You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Perform a JQL Search in ScriptRunner for Jira


Use this snippet to look for issues based on a JQL search. This code can be used as part of a larger bulk-administration or workflow automation task, in the Script Console and other features.


The available issue resolutions in a project have been updated, leaving several issues with incorrect resolution values. I want to locate all issues with the incorrect value, so I can perform a bulk action to update them all. To save me time manually searching, I can use this script to run a JQL search, locating all affected issues.


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira
import import com.atlassian.jira.component.ComponentAccessor import import com.atlassian.jira.web.bean.PagerFilter import org.apache.log4j.Level // Set log level to INFO log.setLevel(Level.INFO) // The JQL query you want to search with final jqlSearch = "Some JQL query" // Some components def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser def searchService = ComponentAccessor.getComponentOfType(SearchService) // Parse the query def parseResult = searchService.parseQuery(user, jqlSearch) if (!parseResult.valid) { log.error('Invalid query') return null } try { // Perform the query to get the issues def results =, parseResult.query, PagerFilter.unlimitedFilter) def issues = results.results issues.each { } issues*.key } catch (SearchException e) { e.printStackTrace() null }
Discovered an issue? Report it here

Suggested for you