This template displays the number of labels in the current work item.
Configuration
To use the Count labels template, simply select it from the template grid. Filter by Misc 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.labels.length}
Display as
Number
Formatting style
Default (unformatted)
Details
1. What does the expression do?
The expression counts the number of labels in the current work item.
2. Step-by-step breakdown
-
%{issue.labels.length}: Refers to the number of labels in the current work item.
3. Examples
-
If a work item has these labels:
frontend,urgent,customer, then%{issue.labels.length}will return3. -
If a work item has no labels, the expression will return
0.
4. Real-life use cases
-
Creating dashboards or filters to quickly identify work items with many or few labels (for example, to spot items that might need better categorization).
-
Auditing work items to ensure labeling standards are followed (e.g., flagging items with too many or too few labels).