This template displays the number of child work items in the current epic excluding sub-tasks.
If the current work item is not an epic, “None” will be displayed.
Configuration
To use the Count work items 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
Jira expression:
issue.stories?.length
Display as
Number
Formatting style
Default (unformatted)
Details
1. What does the expression do?
The expression counts the number of child work items (such as stories, tasks, or bugs) that belong to the current epic, but it does not include sub-tasks. If the current work item is not an epic, it will return “None”.
2. Step-by-step breakdown
-
issue: Refers to the current work item being viewed (in this context, an epic). -
stories: This is a property of an epic that contains a list of all its child work items (excluding sub-tasks). -
?.: This is called the "optional chaining operator." It safely checks if thestoriesproperty exists. If it doesn’t (for example, if the current work item is not an epic), the expression won’t cause an error and will simply return nothing. -
length: This returns the number of items in thestorieslist, which is the count of child work items in the epic.
3. Examples
-
If an epic has 5 child work items (e.g., 3 stories and 2 tasks), the expression will return
5. -
If an epic has no child work items, the expression will return
0. -
If you use this on a work item that is not an epic (like a story or a task), the expression will return nothing.
4. Real-life use cases
-
Epic Progress Tracking: Quickly see how many work items are in an epic to gauge the size or progress of a project.
-
Reporting: Use this count in dashboards or reports to monitor how many tasks are grouped under each epic.
-
Quality Checks: Ensure that epics are not overloaded with too many work items, or identify epics that might be missing child work items.