Hi, I'm totally new to Groovy. I'm trying to fetch issues based on
1)Project category and 2)Custom Label field.
Could anyone help me with this where to start?
Hello,
You can use jql statements on your scripts. Such as:
def appuser = authenticationContext.getLoggedInUser()jqlSearch = "category = test and labels = test"def issues = nullSearchService.ParseResult parseResult = searchService.parseQuery(appuser, jqlSearch)if (parseResult.isValid()) { def searchResult = searchService.search(appuser, parseResult.getQuery(), PagerFilter.getUnlimitedFilter()) issues = searchResult.issues.collect {issueManager.getIssueObject(it.id)}} else { log.error("Invalid JQL: " + jqlSearch);}
After that you can iterate through issues like this:
for (int i = 0; i < issues.size(); i++) { def issue = issues[i] ... your code here ... }
You need to import necessary classes, of course.
Hope this helps.
Regards,
It looks like you're new here. Sign in or register to get started.