Jira automation smart values for comments: get the last comment, its author and visibility
Short answer: Use {{issue.comments.last.body}} for the latest comment on any trigger, and {{comment.body}} for the comment that triggered the rule when the trigger is Work item commented. We ran each smart value on this page in a rule on a Jira Cloud site in November 2026, and note what came back.
Two families of smart values
1. The comment that triggered the rule: {{comment}}. Atlassian documents it for the Work item commented trigger. It is not for other triggers, even when a comment was added as a result.
{{comment.body}}: the comment text.{{comment.author}}: the author's account ID, not the name.{{comment.author.displayName}}returns the name and{{comment.author.accountId}}the ID.{{comment.created}}and{{comment.id}}: when it was posted, and the comment ID.{{comment.visibility.type}}and{{comment.visibility.value}}: for a comment restricted to a project role,roleand the role name (Administratorsin our test). Both were empty for an unrestricted comment.{{comment.internal}}: true or false. It returned false for a comment on a Jira Software work item.
2. The comments on the work item: {{issue.comments}}. It works with any trigger.
{{issue.comments.last.body}}and{{issue.comments.first.body}}: the last and the first comment.{{issue.comments.last.created}}: when the last comment was posted, for example2026-11-29T00:54:46.0+0000.{{issue.comments.last.author}}: the last commenter's account ID.{{issue.comments.last.author.displayName}}gives the name.{{issue.comments.reverse.body}},{{issue.comments.size}}and{{issue.comments.last.id}}work too.- A loop lists them all:
{{#issue.comments}}{{author.displayName}} on {{created}}; {{/}}.
Three example rules
We ran rules 2 and 3 on a Jira Cloud site. Rule 1 uses the same smart values in an email action, which we did not run.
1. Notify on a new comment. Trigger: Work item commented. Action: Send customized email (the older Send email action is deprecated). Subject: {{comment.author.displayName}} commented on {{issue.key}}. Body: {{comment.body}}. {{comment.body}} also returns restricted comments (see below), so add the condition from rule 2 if the recipients can't see them.
2. Show the last comment in a field, skipping restricted comments.
- Create the fields: Last comment (Paragraph), and optionally Last commented by (User picker) and Last comment date (Date time picker).
- Trigger: Work item commented.
- Condition: Advanced compare on
{{comment.visibility.type}}so the rule continues only when it is empty (an unrestricted comment). - Action: Edit work item. Set Last comment to
{{comment.body}}and Last comment date to{{now}}. If a field type won't take a smart value in Choose fields to set, use More options with JSON. We set a User picker this way:{"fields":{"customfield_10100":{"accountId":"{{comment.author.accountId}}"}}}(use your own field's ID). Atlassian recommends More options only for fields that can't be set with Choose fields to set.
3. Name the last commenter. Any trigger. Action: Comment on work item. Text: {{issue.comments.last.author.displayName}} has left a comment on {{issue.key}}.
Why the last comment can come back empty (actor and visibility)
- The rule's actor decides which comments
{{issue.comments}}returns. With the default Automation for Jira actor and a work item whose comments were all restricted,{{issue.comments.size}}was 0 andlast.*was empty in our test. With the actor set to a user who is a member of the restricting role, it returned all 11 comments. If you need restricted comments in a rule, set the actor deliberately and decide who may see the result. - Visibility is read when the rule triggers. If an app restricts a comment a few seconds after it is posted, the rule can still see it as unrestricted. In our test,
{{comment.visibility.type}}was empty for a comment that Loomwise Private Comments restricted about three seconds later.
Restricted and internal comments
A rule copies whatever the smart value returns. In our test, {{comment.body}} put the full text of a role-restricted comment into a Paragraph field that anyone who can see the work item can read. Add the visibility condition from rule 2 and test it with a restricted comment before you turn the rule on. We haven't tested Jira Service Management internal notes in a rule: check {{comment.internal}} on a test work item first.
Gaps
{{comment.*}}only exists for the commented trigger.- Edits don't re-run the rule. A field set from a comment keeps the old text after the comment is edited, unless you add a rule on the Work item comment edited trigger. Deleted comments aren't handled by the commented trigger at all.
- Older work items stay empty until a scheduled rule backfills them or someone comments again.
- Fields maintained by some apps can't be read in a rule. In our test, the fields of Loomwise Comment Snapshot (a Forge app) returned empty in
{{issue.customfield_XXXXX}}even though they had values. Use JQL, columns or export for those. - Automation usage. Atlassian's usage-based billing starts December 3, 2026 and counts steps: each trigger, condition and action that runs is one step. Rule 2 is three steps for an unrestricted comment. A run that ends before any action runs uses no steps. Details: Atlassian's "How is your automation usage calculated" page.
When an app is simpler
Get Comment Snapshot on the Atlassian Marketplace See how Comment Snapshot works
FAQ
How do I get the last comment in a Jira automation rule? Use {{issue.comments.last.body}} on any trigger. Use {{comment.body}} for the comment that triggered the rule when the trigger is Work item commented.
Why is {{issue.comments.last.body}} empty? The comments are read as the rule's actor. In our test, with the default Automation for Jira actor and only restricted comments on the work item, {{issue.comments.size}} was 0 and the last-comment values were empty. With a user who belongs to the restricting role as the actor, all comments came back.
Does editing a comment re-run a Work item commented rule? No. In our test an edit did not run the rule, and Atlassian says the same. Atlassian's trigger list has a separate Work item comment edited trigger.
Can I copy a comment into a field without exposing a restricted comment? Yes, if you add a condition that skips restricted comments, for example an Advanced compare on {{comment.visibility.type}} that only continues when it is empty. Without it, our test copied a restricted comment in full into a Paragraph field.
Related guides
- How to Show the Last Comment as a Column in Jira Cloud's List View
- How to Show the Last Comment on a Jira Dashboard (Filter Results Gadget, 2026)
- JQL: How to Find Jira Issues With No Comment in the Last X Days
- JQL: Find Jira Issues Where Someone Outside Your Team Commented Last
- How to Export Jira Comments to CSV or Excel (Including Only the Last Comment)
- All Jira Cloud guides
Disclosure: Loomwise makes the app mentioned in the card above and wrote this guide. Not affiliated with Atlassian. Smart values tested on a Jira Cloud site in November 2026; Atlassian's smart values page is the reference. Last checked November 2026; Jira menus and features change, so verify in your site. Contact: hello@loomwise.app