Skip to main content

Subtasks count field

This Scripted Number Field shows how many subtasks a work item has.

Applies to: Script Master for Jira Β· Cloud

The script reads only the subtasks field of the work item and counts its entries.

const response = await api.asApp().requestJira(route`/rest/api/3/issue/${payload.issue.id}?fields=subtasks`, {
headers: { 'Accept': 'application/json' }
});
const data = await response.json();

return data.fields?.subtasks?.length ?? 0;