Customise the Comment Header

Scenario

You want to prefix incoming email content processed by JEMH, either issue description during create or a comment.

Solution - Configuration

JEMH has Comment Header TemplateSets, out of the box there are two variants:

Any TemplateSet can be edited and customized, the default and advanced are shown below:

Default

Detailed

Default

Detailed

 

 

The comment header template can be previewed by entering a valid issue key into the Preview Context Issue Key box and then pressing the icon under the comment header text field.

Once a Comment Header TemplateSets has been created, they are referenced through individual Configuration > Email > Templates:

To select a comment header, edit the Email section by clicking on the pen icon

The Comment Header TemplateSets are available in the Comment Header TemplateSet field dropdown:

Selecting the example detailed header here and submitting the form updates the Templates section:

Choose the sender categories this should apply to

By default, the comment headers only apply to non-Jira users (a Non account holder has no Jira account, including a Portal user).  You can choose to include Jira account holders too, see the further setting:

  • Email > Pre-Processing > Prefix content with a Comment Header : Both Jira and Non-Jira users

Test Cases

To illustrate this we'll use a quick JEMH Test Case, the default will work:

Create Test Case

Created Test Case

Test Case Execution Result

Create Test Case

Created Test Case

Test Case Execution Result

 

 

 

Here is the detailed header used in the example, prefixing the description of the issue:

Re-editing the Test Case, and adding the issue key WIKI-6 to the Subject will setup the TestCase to comment on the same issue:

Executing the Test Case shows the same header used with commented text:

Comment header template explicit for commenting but not description

In some cases, you may only want to keep the comment header template active ONLY for comments. In order to achieve this functionality, you'll have to detect if the issue is in context or not.

#if ($!issue) WE ARE IN ISSUE COMMENTING MODE #else WE ARE IN ISSUE CREATING MODE #end



Context

The Context is available for review at edit time, you can use it to link off to Javadoc for Jira API objects as needed - our jemhUtils class is also available, exposing things like the mailbox catchEmailAddress.

context variable

Data Type

Description

context variable

Data Type

Description

message

javax.mail.Message

the raw message object

subject

java.lang.String

the Subject text

jemhUtils

http://ppl-docs.s3-website-us-east-1.amazonaws.com/JEMH/4.1.0/com/javahollic/jira/emh/api/IJEMHVelocityContextUtils.html

JEMH Helper class

 

$jemhUtils.getCatchEmailAddress().getAddress()

java.lang.String

The Mailbox catchEmailAddress

toAddresses

javax.mail.InternetAddress[]

the to: addressees

ccAddresses

javax.mail.InternetAddress[]

the cc: addressees

bccAddresses

javax.mail.InternetAddress[]

the bcc: addressees (don't expect many here!)

allAddresses

javax.mail.InternetAddress[]

all addressees

body

java.lang.String

the post processed (html > markup) content – :warning: since JEMH 2.7.36 for Jira 7.10.x