Hello all, I have bee researching this and have not been able to find the answer. I have a scripted field on a parent task and I would like to sum a field of all child tasks with a specific link type. I have gotten this far with my script but I cannot figure out how to return the value to populate the parent task field. Here is my script so far - the bold area is what i am pretty sure is incorrect to be able to return the results of the jql query.
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.*;
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
// jql query to sum fields
def query = jqlQueryParser.parseQuery("issueFunction in hasLinks('is task of') AND issueFunction in aggregateExpression('Total Story Points', 'customfield_10209.sum()')")
//get results
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())
return results
Thanks in advnace,
Wade