guideonce.
← All guides

Jira Service Management · Email Templates

Email This Issue Templates: Subject, Comments and Echoes

The notification's Subject field does nothing unless the template asks for it, a bare variable can print its own name to a customer, and one toggle decides whether customers get their own reply back.

Where this fits

The migration runbook covers building the notification scheme and templates in sequence (outbound side). The way a missing recipient setting silently stops mail is in the silent-failures post. This one is about what goes in the templates and notifications once mail is flowing.

Email This Issue Cloud's templates are Apache Velocity, and a few of their rules are not obvious: the notification's Subject field does nothing unless the template asks for it, a bare variable can print its own name to a customer, and one toggle decides whether a customer gets their own reply echoed back. This is the template and notification guidance I would want in front of me before building them.

Scope note. Most of this is vendor-documented, and I give the Appfire or Apache behaviour each time. My own first-hand input is thin: one observation that is consistent with the notification's Subject field being plain text, which I did not record as a controlled test, so I treat it as an inference. Where something is inferred and not stated by the vendor, I say so, and the last section lists the lot.

Velocity References: $x, ${x} and $!x

Apache Velocity's documented behaviour, which Email This Issue Cloud's own examples rely on:

SyntaxNameValue existsNull or undefined
$issue.summaryShorthandRenders the valueRenders the literal text $issue.summary
${issue.summary}FormalRenders the valueRenders the literal text ${issue.summary}
$!issue.summaryQuietRenders the valueRenders an empty string
$!{issue.summary}Quiet and formalRenders the valueRenders an empty string

Two points that people merge. The formal notation ${} only removes ambiguity about where a name ends, as in ${issue.key}-reply. It does not change how nulls behave. The quiet notation $! only suppresses null output. Do not confuse $!{foo}, a quiet reference, with !${foo}, which is a boolean NOT.

Does $! behave as expected in Email This Issue Cloud? On the documentary evidence, yes. Every Cloud example in Appfire's documentation uses it, and the Cloud API page says to render attributes in the format $!variable.attribute. Appfire does not say whether the engine runs in Velocity's strict mode, where rendering a null reference without $! throws an exception. Its own default templates would throw on empty fields in strict mode, so non-strict is the only consistent reading. I would confirm it once, using the template Test operation on an issue with an empty optional field.

What I would do: use $! for every output reference in the subject, HTML and text. Use $!{...} only where text immediately follows. Use plain references inside directives, such as #if($issue.assignee). Never ship a bare $ output reference, because a missing field then prints $issue.assignee.displayName to a customer.

Getting the Issue Key into the Subject

Two fields feed the subject, and the template is the one in charge.

So if the template's Subject Template does not contain $!mailSubject, whatever you typed in the notification's Subject field never appears. Manual emails differ, because the subject typed on the Email screen “is not modified further by the email templates when the email is sent.”

Is the notification's Subject field itself evaluated as Velocity? Appfire's Cloud documentation does not say. Where fields are evaluated, they are labelled: the Advanced Email Configuration's Sender Name, From and Reply-To patterns are each described as Velocity-enabled, while the notification Subject is only described as text to be added. I treat it as plain text inserted verbatim into $!mailSubject. That is an inference. The design conclusion holds either way: put all tokens in the template's Subject Template, and use the notification Subject for static wording only.

A Subject Template that does the job:

[$!issue.key] $!issue.summary - $!mailSubject

To avoid a dangling hyphen when the notification Subject is blank:

[$!issue.key] $!issue.summary#if($mailSubject && $mailSubject != "") - $!mailSubject#end

Variable names

NeedCloud referenceStatus
Issue key$!issue.keyDocumented (“Unique Issue Key”)
Summary$!issue.summaryDocumented
Status$!issue.status.nameStatus documented as an object; .name inferred
Type, project$!issue.issueType.name, $!issue.project.nameObjects documented; $!issue.project.name appears in Appfire's Sender Name example
Triggering user$!currentUser.displayNameDocumented
Reporter, assignee$!issue.reporter.displayName, $!issue.assignee.displayNameFollows the documented user pattern; not individually confirmed
Custom field, rendered#renderCustomField($!issue, 'customfield_10603')Documented macro
Custom field, raw$issue.getCustomFieldValue('customfield_12345').valueDocumented example
Request type#renderCustomField($!issue, 'customfield_NNNNN') with your Customer Request Type field IDInferred. Get the ID from the Field Picker

The Server and Data Center product exposes Jira's Java objects and a different macro library, plus features Cloud lacks. Appfire's migration guide tells you to check the available macros on Cloud, so do not paste Server snippets in untested. The editor's Field Picker inserts the exact code for any field and is the authoritative source of names on your own site.

Why the key matters more than it looks

Cloud lookups run in a fixed order: issue key, then headers, then JQL. Key lookup extracts the key from the message subject, is “always active,” and is not confined to any project: the documentation says it “will always search your entire Jira instance.” It tries each key-like string in turn and stops the chain at the first unambiguous match.

With header lookup turned off, the subject key is the only reply-threading mechanism you have. Drop it from a template and every customer reply becomes a new ticket. Two consequences follow from the same fact:

The fix for both is a condition in the handler's rule tree, not anything in the template. Guard the “issue exists” branch with an Issue matches query condition, for example project = HD, and route other matches to an ELSE. That is covered in the rule tree post.

Putting the Comment in a Customer Notification

Add current comment to email body is a Cloud notification option. Appfire's whole documentation of it is: “If enabled, and there's a comment, it is added to the email body.” It does not say which events qualify, how the comment is rendered, or whether it respects internal versus public visibility. I would treat it as rendering the triggering event's comment, and I would not rely on it to filter internal comments.

The template macros are more explicit:

MechanismWhat the documentation says it rendersVisibility
#renderComment() with $commentThe comment the user enters during the operationNo filter
#renderLastComment($!issue)The last comment on the issueNo documented filter
#renderComments($!issue.comments)“Renders the public comments”Public only
#renderAllComments($!issue.comments)“Renders all comments (both public and internal)”Dangerous in a customer template
#renderIssueComments("desc" "1" "public")Latest public comment; takes an order, a count (or “all”) and a public/internal restrictionExplicit public filter, the safest of the set

The Issue Commented theme is the sensible starting point for a notification on events that contain comments, such as an issue being commented or a transition being executed. The other themes are All Details, Issue Updated, Work Logged, Issues list and Empty.

Keep internal notes internal

  1. Event first. Scope the customer comment notification to the Service Management public comment added event, not the generic Issue Commented event, which also fires for internal comments.
  2. Template second. Use #renderIssueComments("desc" "1" "public") so a notification mis-scoped later still cannot leak an internal note.
  3. Attachments. Appfire says that if a notification contains rendered comments, attachments in those comments are added to the email regardless of the attachment policy selected. Enable the policy option so attachments added in internal comments are not included.
  4. Handler comments. Keep customer replies added by the mail handler at All Users visibility.

Stopping Comment Echoes with Include Own Changes

Appfire's description, for Cloud: if the current user is a recipient, enabling Include own changes sends them a notification even if their profile setting says not to. “If the Include own changes toggle is disabled, no notification will be sent to the user triggering the action (regardless of their profile setting).”

It works the same way for every event: it decides whether the triggering user is dropped from the recipients. On a comment that the mail handler creates, the triggering user is the resolved sender, who is the customer. ON echoes their own reply back to them. OFF excludes only them, and other recipients still receive it. Nothing is “broken” unless the customer was the sole recipient, in which case no email is exactly what you want.

The way to get “created includes own changes, comment does not” is that the toggle lives on each Email Notification (Additional Settings tab), not on the scheme. There is also an Event's trigger setting on the notification's Scope (WHEN) tab: created events can be limited to “Jira web interface/Customer portal” or “Mail handler,” and commented events to “Jira web interface,” “Manual email” or “Mail handler.” That gives a pattern like this:

NotificationEventsEvent's triggerRecipientsInclude Own ChangesTemplate
A. Customer acknowledgementIssue CreatedCustomer portal and Mail handlerReporterON (the reporter is the triggering user)Created template with the key in the subject
B. Agent reply to customerService Management Public Comment AddedJira web interface onlyReporter, Request ParticipantsOFFIssue Commented-based, public-filtered macro
C. Customer replied (agent alert)Issue Commented or Public Comment AddedMail handlerAssignee or project roleOFFShort internal template

B never fires for a customer's email reply, because of the trigger filter, and Include Own Changes OFF is a second guard if someone re-ticks “Mail handler.” There is an edge case. If a reply runs as the Default Reporter, because the sender is unknown, the triggering user is the Default Reporter, so only the trigger filter protects the customer. Keep both controls.

Notification A is why Include Own Changes must stay ON for creation: with it off and the reporter as the only recipient, the acknowledgement is dropped, as the silent-failures post describes. I found no published community consensus on the echo problem. This pattern is built from Appfire's documented controls, not copied from anyone's tested setup.

Is Send auto-reply a better acknowledgement?

Not in my case.

If you ever switch, put it last inside IF issue is NOT found, never at the top level, and untick “Mail handler” on notification A.

Editors, Testing and a Few Macros

What Is Documented, Inferred, or Unverified

Status of the claims

Observed myself, loosely: one observation consistent with the notification Subject being plain text, not recorded as a controlled test.

Documented by the vendor: Velocity reference behaviour; $!mailSubject; the Subject Template; the comment macros; Include Own Changes and its Additional Settings location; the Event's trigger options; the key lookup order and its site-wide scope; the Preview and Test behaviour; the auto-reply From address and Default Reporter behaviour.

Inferred, not stated by Appfire: that the notification Subject is plain text and not evaluated; that the engine runs non-strict; the .name and .displayName attribute names; the request type reference; what “Add current comment to email body” does with internal comments.

Not tested: the A, B and C notification pattern as a whole. It follows the documented controls, but I have not run all three together.

Closing Thoughts

Three habits cover most of it. Put every token in the template, because it is the only thing that decides the subject. Use $! everywhere you print, so a missing field is blank, not a variable name. And scope customer notifications twice, by event and by trigger, with Include Own Changes set per notification, so a mistake in one place does not echo a customer's own words back or leak an internal note.


← All guides