I try to use scriprunner jql search to find all issues i need and take a math sum off customfields in this issues.
How to use values from current issue in scriptrunner jql search? And how to sum customfields?
I find next:
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchException
import com.atlassian.jira.web.bean.PagerFilter
def jqlSearch = "project = JIRA and created => current.issue.customfield_11200 and created <= current.issue.customfield 11300 and customfield_22100 = current.issue.customfield _22100"
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def searchService = ComponentAccessor.getComponentOfType(SearchService)
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
try {
sum+= sum of the value "customfield_14200"
}
} catch (SearchException e) {
e.printStackTrace()
}
} else {
log.warn("Invalid query")
return null
}