Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting number of issues for user

Andrew Striletskyi
Contributor
February 22, 2018

Helllo everyone. How to get total number of assigned issues for user using Groovy?

1 answer

1 accepted

0 votes
Answer accepted
Charly [DEISER]
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.
February 22, 2018

Hi @Andrew Striletskyi

You can try this script in the ScriptRunner console

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def userManager = ComponentAccessor.getUserManager()

def assignee = "admin"

def query = jqlQueryParser.parseQuery("assignee = " + assignee)
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())
return results.total

Change the value of "assignee" and you should get what you need.

Cheers.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events