Hello,
I try to learn how to work with fields so i wanted to create "handmade" JQL result in table with listed fields but i don't now how to get to these fields. Here is my code:
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.web.bean.PagerFilter
def jqlSearch = "project = JIRA"
SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
UserUtil userUtil = ComponentAccessor.getUserUtil()
User user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
IssueManager issueManager = ComponentAccessor.getIssueManager()
def result = "<table style=\"width:100%\">"
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
def searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
issueManager.getIssue(searchResult).each{issue ->
result += "<tr><th>" + field1 + "</th>" + "<th>" + field2 + "</th>" + "<th>" + field3 + "</th></tr>" //fields are just for example what i want to get
}
} else {
log.error("Invalid JQL: " + jqlSearch);
}And I know that "issueManager.getIssue(searchResult).each" is wrong but i couldn't find anything similar.
If someone could show me how to at least get one field to this i would be really grateful,
Cheers,
Maciej