This template displays the number of work items and sub-tasks of those work items in the current epic.
Sub-tasks from the epic are excluded from the calculation.
If the current work item is not an epic, “None” will be displayed.
Configuration
To use the Count work items and sub-tasks in epic template, simply select it from the template grid. Filter by Epic to find it faster.
Parameters
This template does not require any additional parameter configuration.
Expert mode
If you switch to Expert mode you can see the formula field in the Expression Parser. You can now tweak the expression to create a custom formula field based on this template.
Expression
General expression:
%{%{issue.issueType} = "Epic" ? count(append(issuesUnderEpic(),subtasks(issuesUnderEpic()))) : null }
Display as
Number
Formatting style
Default (unformatted)
Used parser functions
The links lead to the JWTC documentation because the parser functions are shared functionalities.
Details
1. What does the expression do?
The expression calculates the total number of work items (such as stories or tasks) and their sub-tasks that belong to the current epic. It does not count sub-tasks that are directly under the epic itself. If the current work item is not an epic, it returns “None”.
2. Step-by-step breakdown
Let’s break it down:
-
%{issue.issueType} = "Epic": Checks if the current work item is an epic. -
? ... : null: This is a conditional (if-then-else) structure. If the current work item is an epic, it performs the calculation; otherwise, it returns null (which displays as “None”). -
issuesUnderEpic(): Retrieves all work items that are directly under the current epic. -
subtasks(issuesUnderEpic()): Retrieves all sub-tasks belonging to those work items under the epic. -
append(issuesUnderEpic(), subtasks(issuesUnderEpic())): Combines the list of work items under the epic with the list of their sub-tasks into a single list. -
count(...): Counts the total number of items in the combined list.
3. Examples
-
If an epic contains 3 work items, and those work items have a total of 5 sub-tasks, the expression will return 8.
-
If the current work item is not an epic (for example, a story or a task), the expression will return “None”.
4. Real-life use cases
-
A project manager wants to quickly see the total workload (work items plus sub-tasks) associated with an epic.
-
During sprint planning, a team can use this field to estimate the size of an epic by counting all related work items and their sub-tasks.
-
Reporting dashboards can display this number to help track progress or identify large epics that may need to be broken down further.