Hi All!
We’re using Jira and I’d like to skip importing our “Subtask” issues (cuts the total issue count in half if I do). That part is easy using the JQL additional filter.
The problem I’m having is that I’d like to aggregate any Story Points (and eventually Hours Spent) into the parent Story. I’m trying to test the example for postDocument here and I’m running into several problems.
First, if (issue.fields.subtasks)
is returning false for my sample issue, but the REST call from Jira (JIRA_BASE_URL/rest/api/latest/issue/PPP-NNN?expand=changelog) is returning data in subtasks.
Second (if I ignore the first), postDocument is returning 400, yet I can use the PostMan tool and retrieve results.
if (issue.fields.subtasks ) {
// create a post request body
body = {
jql: "cf[12503] > 0 and parent = " + issue.key,
fields: [
“customfield_12503” // custom field Story Points in sub-tasks
]
}// call post request
response = postDocument(“/rest/api/2/search”, body, {content_type: ‘application/json’});
// there is a response with sub-tasks. get Story Points from any sub-tasks and add to the parent issue
if (response && response.issues) {
for (var i = 0; i < response.issues.length; i++) {
issue.fields.customfield_12503.value += response.issues[i].fields.customfield_12503.value;
}
}
}
The body used in the PostMan tool is:
{
“jql”: “cf[12505]>0 AND parent=DIM-184880”,
“fields”: [
“customfield_12503”
]
}