Hi everyone! Please help .
The code example from the documentation does not produce a specific result for "total issue" https://scriptrunner.adaptavist.com/5.4.49-jira8/jira/recipes/misc/running-a-jql-query.html
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchService = ComponentAccessor.getComponent(SearchService)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getUser()
// edit this query to suit
def query = jqlQueryParser.parseQuery("project = JRA AND assignee = currentUser()" )
def search = searchService.search(user, query, PagerFilter.getUnlimitedFilter())
log.debug("Total issues: ${search.total}")
search.results.each {documentIssue ->
log.debug(documentIssue.key)
// if you need a mutable issue you can do:
def issue = issueManager.getIssueObject(documentIssue.id)
// do something to the issue
log.debug(issue.summary)
}
I can see, that JQL query is exactly the same as mentioned in the snippet. Do you really have project with key = JRA created on your Jira instance?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Martin Bayer [MoroSystems, s.r.o.] !
the result I expect is "total : 2"
in my console log output :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alex I think the problem is in your logging level. Try to change
TO
Otherwise you need to set logging level on the beginning of the script
The results will be displayed on Logs tab
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.