Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 12 Next »

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



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.


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


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 . 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  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.

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.

$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 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'.

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.

$catchEmailAddress












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


Use a test case to verify the new behaviour

You may already have a test case that you can easily rerun to verify the new behaviour, in which case you should skip this bit and run it. Presuming that you don't, lets set one up!

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.


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

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'.

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.




  • No labels