How to execute a filter in script runner

Adolfo Casari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2013

I would like to execute an existing filter by its ID and iterate throught the results, using script runner (groovy).

Is there any example or code snippet on how to do it?

Thanks in advance,

1 answer

1 accepted

1 vote
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2013
def ctx = new JiraServiceContextImpl(authenticationContext.getUser());
def sr = searchRequestService.getFilter(ctx, results = def searchProvider.search(sr.getQuery(), authenticationContext.getUser(), PagerFilter.getUnlimitedFilter())
def issues = results.getIssues();
issues.each {issue-> /*DocumentIssueImpl*/ ... }

I just copied and pasted from different classes, but something like the above.

Anand Unadkat
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2014

Hi Jamie,

How do I get filter ID from this method? sr.getQuery(123456)?

Thanks

Like Luisa Falk likes this

Suggest an answer

Log in or Sign up to answer