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.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.util.ImportUtils
def 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
def sdUser = ComponentAccessor.getUserManager().getUserByKey('Spectrum Admin')
log.warn("the user key is " + sdUser)
The user key is always null.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using the username or display name of the user?
Usernames don't have spaces
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.