Breadcrumbs

Last comment author

📚

This template displays the name of the author of the last comment posted in the current work item.

If there is nothing to display, the result will be “None”.

Configuration

To use the Last comment author 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[issue?.comments?.length-1]?.author?.displayName || ""

Details

1. What does the expression do?

This expression retrieves the name of the person who wrote the most recent comment on the current work item. If there are no comments, it returns an empty value.


2. Step-by-step breakdown

Let’s break it down:

  • issue?.comments
    This accesses the list of comments on the work item, if any exist.

  • issue?.comments?.length-1
    This calculates the index of the last comment. For example, if there are 3 comments, their indexes are 0, 1, and 2, so length-1 gives you the last one.

  • issue?.comments[issue?.comments?.length-1]
    This retrieves the last comment in the list.

  • ?.author?.displayName
    This gets the display name (full name) of the person who wrote that last comment. Again, optional chaining is used to avoid errors if any part is missing.

  • || ""
    This means "or an empty string." If there are no comments (so nothing to display), the result will be an empty value.


3. Examples

  • If a work item has three comments, and the last one was written by "Jane Doe," the expression will return "Jane Doe."

  • If there are no comments, the expression will return an empty string (which the field displays as “None”).


4. Real-life use cases

  • Displaying the name of the last person who commented on a work item in a dashboard or report.

  • Creating a custom field in Jira to quickly see who last interacted with a work item via comments.

  • Filtering or sorting work items based on the most recent commenter for follow-up or review.