Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Using JQL filters in ScriptRunner - Possible? How?

Using JQL filters in ScriptRunner - Possible? How?

Is it possible (if so how) to use JQL queries from Jira in ScriptRunner?  Or, does one have to learn yet another language?  I'm hoping to access existing filters in Jira from ScriptRunner.  Specifically attempting to fix a large number of tickets that have an open Resolution status ( a scenario I/we inherited).


Thnx for the insight!

1 answer

Sure, you can run any JQL, including a filter, in a ScriptRunner script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.web.bean.PagerFilter

//Put your JQL query here
String jqlSearch = "filter = 'BR Insurance Issues'"

SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
UserUtil userUtil = ComponentAccessor.getUserUtil()
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
IssueManager issueManager = ComponentAccessor.getIssueManager()
List<MutableIssue> issues = null
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
SearchResults searchResult =, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
issues = searchResult.getResults().collect {issueManager.getIssueObject(}
} else {
log.error("Invalid JQL: " + jqlSearch);

Suggest an answer

Log in or Sign up to answer