Hello team
i would like to get all issues in one project and to compare the number with issues in the same project which has the status in progress. Thanks
Take a look at the script. I think this gets the job done for you.
In case you want to further process the issues, you can use the optional loop
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.search.SearchProviderimport com.atlassian.jira.jql.parser.JqlQueryParserimport com.atlassian.jira.web.bean.PagerFilterimport com.atlassian.jira.event.type.EventDispatchOptionimport com.atlassian.jira.issue.MutableIssueimport com.atlassian.jira.issue.index.IssueIndexingServiceimport com.atlassian.jira.util.ImportUtilsdef issueManager = ComponentAccessor.getIssueManager()def customFieldManager = ComponentAccessor.getCustomFieldManager()def sdUser = ComponentAccessor.getUserManager().getUserByKey('robot')def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)def searchProvider = ComponentAccessor.getComponent(SearchProvider)def query1 = jqlQueryParser.parseQuery("project = XYZ")def query2 = jqlQueryParser.parseQuery("project = XYZ and status =\"In Progress\" ")def results1 = searchProvider.search(query1, sdUser, PagerFilter.getUnlimitedFilter())def results2 = searchProvider.search(query2, sdUser, PagerFilter.getUnlimitedFilter())log.warn("All issues=" + results1.total)log.warn("In Progress Issues=" + results2.total)//if you want to do something with the issues, use the following loop/*results1.getIssues().each() { documentIssue -> def issue = issueManager.getIssueObject(documentIssue.id) //something goes here}*///x
@Gezim Shehu [Communardo] , first of all thank you for your reponse , but ecxcuse i make my userByKey and project key , but always results = 0 for all issues and in progress.
def sdUser = ComponentAccessor.getUserManager().getUserByKey('Spectrum Admin')
log.warn("the user key is " + sdUser)
The user key is always null.
Are you using the username or display name of the user?
Usernames don't have spaces
it works fine . I solve it .
It looks like you're new here. Sign in or register to get started.