This template displays the text of the first comment posted in the current work item.
If there is nothing to display, the result will be “None”.
Configuration
To use the First comment template, simply select it from the template grid. Filter by Comment 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?.comments[0]?.body?.plainText == null ? '' : issue?.comments[0]?.body?.plainText
The text will be returned using wiki markup, e.g. bold text will be shown as *bold text*.
Details
1. What does the expression do?
The expression retrieves the text of the first comment posted on the current work item. If there are no comments, it returns an empty string.
2. Step-by-step breakdown
Let’s break it down:
-
issue?.comments[0]: This tries to access the first comment (index 0) of the current work item. The?(optional chaining) means it won’t cause an error if there are no comments. -
?.body?.plainText: This continues to safely access the body of the comment and then its plain text content, again using optional chaining to avoid errors if any part is missing. -
== null ? '' : ...: This checks if the plain text of the first comment isnull(or doesn’t exist). If so, it returns an empty string (''). Otherwise, it returns the plain text of the first comment.
3. Examples
-
If the work item has at least one comment, and the first comment says “Looks good!”, the expression will return: Looks good!
-
If there are no comments, the expression will return an empty string (which the template displays as “None”).
4. Real-life use cases
-
Displaying the first feedback or question posted on a work item directly in a dashboard or report.
-
Quickly surfacing the initial comment for review or triage purposes.
-
Creating custom fields or views that highlight the first user interaction on a work item.