Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This How To will take you through the configuration of the JEMHC Postfunction to drive notifications in response to workflow changes.

Step-by-step guide

  1. Create a simple Ad hoc TemplateSet for use by the Postfunction with a static recipient
  2. Create a JEMHC Postfunction in an existing workflow
  3. Verify notification
  4. Next Steps: Field by Field Configuration of the Postfunction
Info

Velocity is a Template language used by JIRA, and JEMHC. It allows dynamic injection of 'values' into a template, a process called rendering. Velocity markup is not hard to learn, and the helper tools made available in JEMHC should make it very powerful and flexible.

Create a simple Ad hoc TemplateSet

Template Sets are composed of a Subject, TEXT content and separate HTML content.  Its more work to edit in HTML, examples are always given in TEXT.

(info) A 'twist' to configuration is that in order to 'easily' edit an adhoc Template, you will need to capture a Postfunction Webhook, but in order to do that you need to configure a JEMHC postfunction first.  The template set will be trivial to start with to prove basic configuration, then later more details can be added.

Create the TemplateSet

Navigate to JEMHC > Notifications > Template Sets, and select All Event Groups.  Pick a theme that you want this notification to be styled/associated with, in the example below, we have a copy of the JEMHC system JIRA theme called JIRA Support.

Image Removed

Clicking Create will popup the TemplateSet creation dialog, set the name, select the theme and TemplateSet Type, which should be Adhoc Notifications, and submit.

Image Removed

Then, its also possible to copy from an existing template of that nominated type in the nominated theme, or blank:

Image Removed

On Submit you will be taken to the TemplateSet editor:

Edit the Template Set

Image Removed

Scroll down the editor to get to the content section, its also possible to preview the content (below).  To get back to edit, just hit the same icon.

Edit TimePreview Time
Image RemovedImage Removed

Full details of the Velocity Context are also available in the UI, which are hyperlinked to external Javadoc sources:

Image Removed

Save the Template Set

Don't forget!

Image Removed

View the available Ad hoc Template Sets

Change the Event Group to 'Ad hoc Notifications'

Image Removed

Which then shows:

Image Removed

Create a JEMHC Postfunction

Verify notification

Next Steps

Preview Context

A preview context can be created from captured Postfunction Webhooks.  This is done in Auditing > Events > PostFunction Notification entries.  Once Created they can be selected in the Editor (show previously), which can then be used within the template:

Image Removed

The content of the Preview Context is JSON and looks like this:

Image Removed

(info) JEMHC has some editor autocomplete that allows you to drill into this structure:

No Format
 $context.<CTRL-SPACE>

With this, its possible to (later) build up an expression like $context.user.name, but thats the JSON object, to get the 'text' of the node, you also need to use .textValue(), so a subject could be:

No Format
$context.user.name.textValue() did something to $context.issue.key.textValue()

 

Table of Contents

A workflow post function provided by JEMH can be used to send notifications to specific recipients when an issue workflow transition occurs.

Adding a post function to an issue workflow

  1. Start by editing the target Jira issue workflow. Select Settings > Issues and click Workflows. Click Edit on the relevant workflow.

  2. Select the target workflow transition either in the diagram or text view

  3. Select the Post Functions tab and click Add post function

  4. Select the JEMHCloud post function that you would like to use, and click the Add button

Configuring a post function

Notification contents

The Content tab has settings that allow the contents of the post function notification to be set. An Ad hoc type notification template set can be selected, along with the format (HTML or text), along with custom text content specific to this particular notification.

Please note that the custom text content Message field should be used as an additional plain text message. Follow Create custom Theme and Template Sets to customize notifications using the provided $issue context

Recipients

The To, CC and BCC tabs allow you to specify exactly who the recipients of the notification are:

Sender Email Address can be defined, this is the address used in the email notification’s From header. Varying it is useful in some situations but your outbound mail server must allow it.

Sender Personal defines the display name of the sender address for the notification (if the configured outbound connection allows this). This should not include quotes, just the text required (for example, setting NotificationBot for this setting could result in the From header looking like NotificationBot <from.address@example.com>

Reply-To Email Address is optional and sets the Reply-To header address of the email notification.

Attachments

Its possible to include attachments in post function notifications

  • All Attachments: which makes sense during 'create', and can be limited to a filename filter.  The Filename Filter is a comma separated list of regular expressions - a type of data used in JEMHC and JEMH a lot.

  • Recent Attachments: can also be used, but due to the issue above, a 'time window' is required to look back from the issue event, to find attachments created within.  This works fine on create, ad fine for simple file uploads with a small comment (e.g. within 30s) but will fail for 'big' comments.

Issue commenting

The settings on the Issue Update tab allow you to choose whether the post function notification is recorded on the related issue as a comment.

Further settings

Here you can select the Message Outbound configuration that describes the outbound mail server.  It isn't possible to know the status of a given Message Outbound in the post function at this time(i.e. it could be offline or a dead-letterbox configuration).

Post function ordering

It is important to make sure that the post function you add to the workflow is positioned correctly in the post function execution order. Initially the added post function will be first in the list - this is not ideal as field changes in the issue transition have not yet been applied. Move the JEMHC post function down until after the Issue has been re-indexed. This will reduce the chance of issues occurring due to missing data.

Before:

...

After:

...

Make the workflow active

In order for your workflow changes to persist, you must commit them. To do this, click Publish Draft shown in the Jira warning at the top of the workflow configuration screen.

...

Frequently Asked Questions

How Many Emails Get Sent?

The behaviour of email-based post functions is that one email is sent that includes every recipient (To, CC, BCC).

What changes have been made due to GDPR

Methods of access to personally identifiable data have been changed to comply with GDPR. Details about these changes can be found in this blog post.

Filter by label (Content by label)
showLabelsfalse
max5
spacesJEMHC
sortmodified
showSpacefalse

...

reversetrue
typepage
cqllabel in ( "postfunction" , "adhoc" ) and type = "page" and space = "JEMHC"
labelspostfunction adhoc
Page Properties
hiddentrue


Related issues