This template displays the number of attachments in the current work item.
Configuration
To use the Count attachments template, simply select it from the template grid. Filter by Attachment 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.attachments.length}
Display as
Number
Formatting style
Default (unformatted)
Details
1. What does the expression do?
The expression counts the number of attachments in the current work item.
2. Step-by-step breakdown
-
%{issue.attachments.length}: Refers to the number of attachments of the current work item.
So, %{issue.attachments.length} means: "Count how many attachments are present in this work item."
3. Examples
-
If a work item has 3 files attached, the expression will return
3. -
If there are no attachments, it will return
0.
4. Real-life use cases
-
Displaying the number of attachments directly in a report or dashboard for each work item.
-
Creating a custom field that highlights work items missing required documentation (e.g., showing a warning if the count is
0). -
Filtering or sorting work items based on how many attachments they have (for example, to find items with unusually many or few attachments).