Hi @Mehhss
For your requirement, I suggest taking a look and ScriptRunner's HAPI feature to simplify your code.
You could try something like below on the ScriptRunner Console to get the total number of issues returned in the result
Issues.count("""
'ISSUETYPE' IN ('PERSON') AND 'STATUS' IN ('ACTIVE, INACTIVE') AND PROJECT IN ('Project1') AND 'ID NUMBER' ~ 'ID1234' ORDER BY 'END DATE' DESC, 'START DATE' DESC""")
If the result is greater than 0 then you can try to see what is the output returned:-
Issues.search("""'ISSUETYPE' IN ('PERSON') AND 'STATUS' IN ('ACTIVE, INACTIVE') AND PROJECT IN ('Project1') AND 'ID NUMBER' ~ 'ID1234' ORDER BY 'END DATE' DESC, 'START DATE' DESC"""
).each { issue ->
log.warn "=====>>> ${issue.key}"
}
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
Hi there!
Assuming that your JQL is correct, I can only think that the executeUser does not have permission to view the issues, resulting in 0 results.
Here is what I would do:
Here is a sample that worked in my istance, using the loggedIn user, that is yourself when you execute in the Script Console:
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
JqlQueryParser jqlParser = ComponentAccessor.getComponent(JqlQueryParser.class)
String JQL = "key = JIRA-1015"
def query = jqlParser.parseQuery(JQL)
def queryUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def result = searchService.search(queryUser, query, PagerFilter.getUnlimitedFilter())
return result.total
Jeroen
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.