Versions Compared

Key

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

Assumptions: That you already have a profile that is linked to a Jira project.

Table of Contents


...

Add a custom field to your project

To populate a custom field you must first have one. Go to your Jira settings page, then select Issues, then Custom Fields.

...


Click 'Add custom field'.

...


Select your desired type of custom field. I've opted for a text field (multi-line) type.Image Removed

...


Give the field a name and a description (description is optional).Image Removed

...


Add your new custom field to your desired projects by ticking the checkbox beside them. Ensure that you scroll to the bottom of the page and click 'Update' to persist your project configurations.

...



...

Configure 'Custom Field Defaults'

Go into your profile and configure it by clicking the small cog beside it Image Modified. Go into the Project Mappings view. You can either configure the new Custom Field Default to be at the default project mapping resulting in your other mappings inheriting it, or you can configure it to only be in one of your non-default project mappings. I've opted to put my Custom Field Default into my default project mapping so that all of my other mappings also get it.

Click the little cog Image Modified beside the project mapping you've elected. Go into the 'Issue' view and click the 'Edit' button found towards the top right.

Scroll down to section titled 'Custom Field Defaults' (sounds familiar... (smile)) and click the bold text that says "Velocity Context" to see the objects available at the time JEMHC processes an inbound mail.Image Removed

...

Locate your custom field. The one I created earlier on is called 'Recipients Email Addresses'. Using the objects described by the URLs under the Velocity Context I'm going to type in the following text.

No Formatcode
$message.to

The Velocity statement '$message' retrieves a Java object of the type IMessage which is described by the Velocity Context. The details of the IMessage interface are shown within the JavaDoc Javadoc that you can see by following the link displayed within the Velocity Context section. The IMessage interface has a method with the signature of 'getTo()' that can be used to get the recipients' email addresses. To use this method we remove the 'get' part and the parenthesis resulting in the script you can see prior to this paragraph.

My Custom Field Default configuration now looks like the image blow. Notice how the box below the script has been set to 'Velocity' and how the box beside and to the right has been set to 'On Create'.Image Removed.

...

You may also want to track the incoming mailbox address, the catchemail, in order to use the custom field during notification, to retain a consistent sender address with what the user used initially.

Code Block
$catchEmailAddress












Scroll to the bottom of the page and click 'Submit'.

...

My test case depends on the following email address being set in your profiles 'Catch Email Addresses' section. JEMHC will see that the 'To' address matches with this and will then process the email.Image Removed


...

Go to the 'Test Cases' view and click 'Create'.Image Removed

...

Select the project that your profile is linked to. Select your profile. Copy and paste the contents of the text-block below into the 'Content' section. Click 'Submit'.

No Formatcode
MIME-Version: 1.0
Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT)
Date: Sun, 19 Jun 2011 17:42:26 +1200
Subject: Email sender inject into field test
From: "Jonathan Smitherington" <johnsmith@emaildomain.com>
To: mustCatchThisEmail@emaildomain.com
CC: anotheruser@faraway.com
Content-Type: text/plain; charset=UTF-8

This email body will go in the description of the ticket.

...