Script Runner - Get All Issues Logged User with Status "in Progress" ?

How do I get all the issues "in progress" of the logged in user?

2 answers

status = "In Progress" and assignee = currentUser()

0 vote
Henning Tietgens Community Champion Jan 26, 2014

You have to do a search in your script with the JQL stated by Chris. You could use a method like this.

import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.ApplicationUsers
import com.atlassian.jira.web.bean.PagerFilter

static List<Issue> getFilterResult(String jqlSearch, ApplicationUser user) {
    SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
    IssueManager issueManager = ComponentAccessor.getIssueManager()
    List<Issue> issues = null

    SearchService.ParseResult parseResult =  searchService.parseQuery(ApplicationUsers.toDirectoryUser(user), jqlSearch)
    if (parseResult.isValid()) {
        def searchResult = searchService.search(ApplicationUsers.toDirectoryUser(user), parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
        // Transform issues from DocumentIssueImpl to the "pure" form IssueImpl (some methods don't work with DocumentIssueImps)
        // This is not needed in every place and the collect{} part maybe skipped for better performance 
        issues = searchResult.issues.collect {issueManager.getIssueObject(it.id)}
    }
    return issues
}

This method is completely without logging and only with basic error handling, so feel free to expand. :-)

Hi Henning.

Could you show me how to pick up the logged in user and also how to do JQL?

thank you

Henning Tietgens Community Champion Jan 26, 2014

Yes, you can get the current user like this

ApplicationUser user = ComponentAccessor.jiraAuthenticationContext.getUser()

And the jqlSearch String is the same you would enter as an advanced search in JIRA.

String jqlSearch = 'status = "In Progress" and assignee = currentUser()'

Wow !

Nice Job Henning, Tank s !

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,305 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